# SOME DESCRIPTIVE TITLE. # Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. # # Translators: # tomo, 2024 # Rafael Fontenelle , 2024 # Takeshi Nakazato, 2024 # #, fuzzy msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-04-11 14:19+0000\n" "PO-Revision-Date: 2021-06-28 00:55+0000\n" "Last-Translator: Takeshi Nakazato, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" "MIME-Version: 1.0\n" "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 msgid "Futures" msgstr "Future" #: ../../library/asyncio-future.rst:10 msgid "" "**Source code:** :source:`Lib/asyncio/futures.py`, :source:`Lib/asyncio/" "base_futures.py`" msgstr "" "**ソースコード:** :source:`Lib/asyncio/futures.py`, :source:`Lib/asyncio/" "base_futures.py`" #: ../../library/asyncio-future.rst:15 msgid "" "*Future* objects are used to bridge **low-level callback-based code** with " "high-level async/await code." msgstr "" "*Future* オブジェクトは **低水準のコールバックベースのコード** と高水準の " "async/await コードとの間を橋渡しします。" #: ../../library/asyncio-future.rst:20 msgid "Future Functions" msgstr "Future の関数" #: ../../library/asyncio-future.rst:24 msgid "Return ``True`` if *obj* is either of:" msgstr "オブジェクト *obj* が下記のいずれかであれば ``True`` を返します:" #: ../../library/asyncio-future.rst:26 msgid "an instance of :class:`asyncio.Future`," msgstr ":class:`asyncio.Future` クラスのインスタンス" #: ../../library/asyncio-future.rst:27 msgid "an instance of :class:`asyncio.Task`," msgstr ":class:`asyncio.Task` クラスのインスタンス" #: ../../library/asyncio-future.rst:28 msgid "a Future-like object with a ``_asyncio_future_blocking`` attribute." msgstr "``_asyncio_future_blocking`` 属性を持った Future 的なオブジェクト" #: ../../library/asyncio-future.rst:36 msgid "Return:" msgstr "下記のいずれかを返します:" #: ../../library/asyncio-future.rst:38 msgid "" "*obj* argument as is, if *obj* is a :class:`Future`, a :class:`Task`, or a " "Future-like object (:func:`isfuture` is used for the test.)" msgstr "" "*obj* が :class:`Future` オブジェクト、 :class:`Task` オブジェクト、または " "Future 的なオブジェクト (:func:`isfuture` 関数を使って検査します) である場合" "には *obj* そのもの" #: ../../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()``." msgstr "" "引数 *obj* がコルーチンである (:func:`iscoroutine` 関数を使って検査します) 場" "合には *obj* をラップした :class:`Task` オブジェクト; この場合コルーチンは " "``ensure_future()`` によりスケジュールされます。" #: ../../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.)" msgstr "" "引数 *obj* が awaitable である (:func:`inspect.isawaitable` 関数を使って検査" "します) 場合には *obj* を await する :class:`Task` オブジェクト" #: ../../library/asyncio-future.rst:50 msgid "If *obj* is neither of the above a :exc:`TypeError` is raised." msgstr "" "引数 *obj* が上記のいずれにもあてはまらない場合は :exc:`TypeError` 例外を送出" "します。" #: ../../library/asyncio-future.rst:54 msgid "" "See also the :func:`create_task` function which is the preferred way for " "creating new Tasks." msgstr "" "Task を生成するより好ましい方法である :func:`create_task` 関数も参照してくだ" "さい。" #: ../../library/asyncio-future.rst:57 msgid "" "Save a reference to the result of this function, to avoid a task " "disappearing mid-execution." msgstr "" #: ../../library/asyncio-future.rst:60 msgid "The function accepts any :term:`awaitable` object." msgstr "" "この関数はどんな :term:`awaitable` なオブジェクトでも受け入れるようになりまし" "た。" #: ../../library/asyncio-future.rst:63 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 "" #: ../../library/asyncio-future.rst:70 msgid "" "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:73 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 "" #: ../../library/asyncio-future.rst:79 msgid "Future Object" msgstr "Future オブジェクト" #: ../../library/asyncio-future.rst:83 msgid "" "A Future represents an eventual result of an asynchronous operation. Not " "thread-safe." msgstr "" "Future は非同期処理の最終結果を表すクラスです。スレッドセーフではありません。" #: ../../library/asyncio-future.rst:86 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 "" #: ../../library/asyncio-future.rst:91 msgid "" "Typically Futures are used to enable low-level callback-based code (e.g. in " "protocols implemented using asyncio :ref:`transports `) to interoperate with high-level async/await code." msgstr "" "典型的には、 Future は低水準のコールバックベースのコード (たとえば asyncio " "の :ref:`transports ` を使って実装されたプロト" "コル) が高水準の async/await と相互運用することを可能にするために利用されま" "す。" #: ../../library/asyncio-future.rst:96 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." msgstr "" "経験則は Future オブジェクトをユーザー向けの API であらわに利用しないことで" "す。推奨される Future オブジェクトの生成方法は :meth:`loop.create_future` を" "呼び出すことです。これによりイベントループの代替実装は、自身に最適化された " "Future オブジェクトの実装を合わせて提供することができます。" #: ../../library/asyncio-future.rst:102 msgid "Added support for the :mod:`contextvars` module." msgstr ":mod:`contextvars` モジュールのサポートを追加。" #: ../../library/asyncio-future.rst:105 msgid "" "Deprecation warning is emitted if *loop* is not specified and there is no " "running event loop." msgstr "" #: ../../library/asyncio-future.rst:111 msgid "Return the result of the Future." msgstr "Future の結果を返します。" #: ../../library/asyncio-future.rst:113 msgid "" "If the Future is *done* and has a result set by the :meth:`set_result` " "method, the result value is returned." msgstr "" "Future が *完了* していて、 :meth:`set_result` メソッドにより設定された結果を" "持っている場合は結果の値を返します。" #: ../../library/asyncio-future.rst:116 msgid "" "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:119 ../../library/asyncio-future.rst:207 msgid "" "If the Future has been *cancelled*, this method raises a :exc:" "`CancelledError` exception." msgstr "" "Future が *キャンセルされた* 場合、このメソッドは :exc:`CancelledError` 例外" "を送出します。" #: ../../library/asyncio-future.rst:122 msgid "" "If the Future's result isn't yet available, this method raises an :exc:" "`InvalidStateError` exception." msgstr "" #: ../../library/asyncio-future.rst:127 msgid "Mark the Future as *done* and set its result." msgstr "Future を *完了* とマークし、結果を設定します。" #: ../../library/asyncio-future.rst:129 ../../library/asyncio-future.rst:136 msgid "" "Raises an :exc:`InvalidStateError` error if the Future is already *done*." msgstr "" #: ../../library/asyncio-future.rst:134 msgid "Mark the Future as *done* and set an exception." msgstr "Future を *完了* とマークし、例外を設定します。" #: ../../library/asyncio-future.rst:141 msgid "Return ``True`` if the Future is *done*." msgstr "Future が *完了* しているなら ``True`` を返します。" #: ../../library/asyncio-future.rst:143 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` メソッドの呼び出しにより結果や例外が設定された場合に *完了* " "とみなされます。" #: ../../library/asyncio-future.rst:149 msgid "Return ``True`` if the Future was *cancelled*." msgstr "Future が *キャンセルされた* 場合に ``True`` を返します。" #: ../../library/asyncio-future.rst:151 msgid "" "The method is usually used to check if a Future is not *cancelled* before " "setting a result or an exception for it::" msgstr "" "通常の場合、このメソッドは Future に処理結果や例外を設定する前に Future が *" "キャンセルされていない* ことを確認するために使用されます::" #: ../../library/asyncio-future.rst:154 msgid "" "if not fut.cancelled():\n" " fut.set_result(42)" msgstr "" #: ../../library/asyncio-future.rst:159 msgid "Add a callback to be run when the Future is *done*." msgstr "Future が *完了* したときに実行されるコールバックを追加します。" #: ../../library/asyncio-future.rst:161 msgid "The *callback* is called with the Future object as its only argument." msgstr "*callback* は Future オブジェクトだけを引数にとって呼び出されます。" #: ../../library/asyncio-future.rst:164 msgid "" "If the Future is already *done* when this method is called, the callback is " "scheduled with :meth:`loop.call_soon`." msgstr "" "このメソッドが呼び出される時点ですでに Future が *完了* している場合、コール" "バックは :meth:`loop.call_soon` メソッドによりスケジュールされます。" #: ../../library/asyncio-future.rst:167 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." msgstr "" "オプションのキーワード引数 *context* を使って、コールバック*callback* を実行" "する際のコンテキスト :class:`contextvars.Context` を設定することができます。" "コンテキスト *context* が指定されない場合は現在のコンテキストが使われます。" #: ../../library/asyncio-future.rst:171 msgid "" ":func:`functools.partial` can be used to pass parameters to the callback, e." "g.::" msgstr "" "コールバックにパラメータを渡すには、次の例のように :func:`functools.partial` " "を使うことができます::" #: ../../library/asyncio-future.rst:174 msgid "" "# Call 'print(\"Future:\", fut)' when \"fut\" is done.\n" "fut.add_done_callback(\n" " functools.partial(print, \"Future:\"))" msgstr "" #: ../../library/asyncio-future.rst:178 msgid "" "The *context* keyword-only parameter was added. See :pep:`567` for more " "details." msgstr "" "キーワード引数 *context* が追加されました。詳細は :pep:`567` を参照してくださ" "い。" #: ../../library/asyncio-future.rst:184 msgid "Remove *callback* from the callbacks list." msgstr "コールバックリストから *callback* を削除します。" #: ../../library/asyncio-future.rst:186 msgid "" "Returns the number of callbacks removed, which is typically 1, unless a " "callback was added more than once." msgstr "" "削除されたコールバックの数を返します。コールバックが複数回追加されていない限" "り、通常は1が返ります。" #: ../../library/asyncio-future.rst:191 msgid "Cancel the Future and schedule callbacks." msgstr "Future をキャンセルし、コールバックをスケジュールします。" #: ../../library/asyncio-future.rst:193 msgid "" "If the Future is already *done* or *cancelled*, return ``False``. Otherwise, " "change the Future's state to *cancelled*, schedule the callbacks, and return " "``True``." msgstr "" "Future がすでに *完了* または *キャンセル* された場合、 ``False`` を返しま" "す。そうでない場合 Future の状態を *キャンセル* に変更した上でコールバックを" "スケジュールし、 ``True`` を返します。" #: ../../library/asyncio-future.rst:197 msgid "Added the *msg* parameter." msgstr "" #: ../../library/asyncio-future.rst:202 msgid "Return the exception that was set on this Future." msgstr "この Future オブジェクトに設定された例外を返します。" #: ../../library/asyncio-future.rst:204 msgid "" "The exception (or ``None`` if no exception was set) is returned only if the " "Future is *done*." msgstr "" "例外 (または例外が設定されていないときは ``None``) は Future が *完了* してい" "る場合のみ返されます。" #: ../../library/asyncio-future.rst:210 msgid "" "If the Future isn't *done* yet, this method raises an :exc:" "`InvalidStateError` exception." msgstr "" "Future が *未完了* の場合、このメソッドは :exc:`InvalidStateError` 例外を送出" "します。" #: ../../library/asyncio-future.rst:215 msgid "Return the event loop the Future object is bound to." msgstr "Future オブジェクトが束縛されているイベントループを返します。" #: ../../library/asyncio-future.rst:222 msgid "" "This example creates a Future object, creates and schedules an asynchronous " "Task to set result for the Future, and waits until the Future has a result::" msgstr "" "この例は Future オブジェクトを生成し、Future に結果を設定するための非同期タス" "クを生成してスケジュールし、そして Future に結果が設定されるまで待機します::" #: ../../library/asyncio-future.rst:226 msgid "" "async def set_after(fut, delay, value):\n" " # Sleep for *delay* seconds.\n" " await asyncio.sleep(delay)\n" "\n" " # Set *value* as a result of *fut* Future.\n" " fut.set_result(value)\n" "\n" "async def main():\n" " # Get the current event loop.\n" " loop = asyncio.get_running_loop()\n" "\n" " # Create a new Future object.\n" " fut = loop.create_future()\n" "\n" " # Run \"set_after()\" coroutine in a parallel Task.\n" " # We are using the low-level \"loop.create_task()\" API here because\n" " # we already have a reference to the event loop at hand.\n" " # Otherwise we could have just used \"asyncio.create_task()\".\n" " loop.create_task(\n" " set_after(fut, 1, '... world'))\n" "\n" " print('hello ...')\n" "\n" " # Wait until *fut* has a result (1 second) and print it.\n" " print(await fut)\n" "\n" "asyncio.run(main())" msgstr "" #: ../../library/asyncio-future.rst:257 msgid "" "The Future object was designed to mimic :class:`concurrent.futures.Future`. " "Key differences include:" msgstr "" "Future オブジェクトは :class:`concurrent.futures.Future` を模倣してデザインさ" "れました。両者の重要な違いは以下の通りです:" #: ../../library/asyncio-future.rst:260 msgid "" "unlike asyncio Futures, :class:`concurrent.futures.Future` instances cannot " "be awaited." msgstr "" "asyncio の Futures と異なり、 :class:`concurrent.futures.Future` インスタンス" "は待ち受けできません。" #: ../../library/asyncio-future.rst:263 msgid "" ":meth:`asyncio.Future.result` and :meth:`asyncio.Future.exception` do not " "accept the *timeout* argument." msgstr "" ":meth:`asyncio.Future.result` と :meth:`asyncio.Future.exception` は " "*timeout* 引数を取りません。" #: ../../library/asyncio-future.rst:266 msgid "" ":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` 例外を送出します。" #: ../../library/asyncio-future.rst:270 msgid "" "Callbacks registered with :meth:`asyncio.Future.add_done_callback` are not " "called immediately. They are scheduled with :meth:`loop.call_soon` instead." msgstr "" ":meth:`asyncio.Future.add_done_callback` メソッドによって登録されたコールバッ" "クは、即座に呼び出されません。代わりにコールバックは :meth:`loop.call_soon` " "によりスケジュールされます。" #: ../../library/asyncio-future.rst:274 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` との互換性がありません。" #: ../../library/asyncio-future.rst:278 msgid "" ":meth:`asyncio.Future.cancel` accepts an optional ``msg`` argument, but :" "meth:`concurrent.futures.Future.cancel` does not." msgstr ""