# SOME DESCRIPTIVE TITLE. # Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2026-09-28 03:11+0000\n" "PO-Revision-Date: 2026-05-08 17:17+0000\n" "Language-Team: German (https://app.transifex.com/python-doc/teams/5390/de/)\n" "Language: de\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: ../../library/asyncio-future.rst:8 msgid "Futures" msgstr "" #: ../../library/asyncio-future.rst:10 msgid "" "**Source code:** :source:`Lib/asyncio/futures.py`, :source:`Lib/asyncio/" "base_futures.py`" msgstr "" #: ../../library/asyncio-future.rst:15 msgid "" "*Future* objects are used to bridge **low-level callback-based code** with " "high-level async/await code." msgstr "" #: ../../library/asyncio-future.rst:20 msgid "Future Functions" msgstr "" #: ../../library/asyncio-future.rst:24 msgid "Return ``True`` if *obj* is either of:" msgstr "" #: ../../library/asyncio-future.rst:26 msgid "an instance of :class:`asyncio.Future`," msgstr "" #: ../../library/asyncio-future.rst:27 msgid "an instance of :class:`asyncio.Task`," msgstr "" #: ../../library/asyncio-future.rst:28 msgid "a Future-like object with a ``_asyncio_future_blocking`` attribute." msgstr "" #: ../../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 "" #: ../../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 "" #: ../../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 "" #: ../../library/asyncio-future.rst:50 msgid "If *obj* is neither of the above a :exc:`TypeError` is raised." msgstr "" #: ../../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 "" #: ../../library/asyncio-future.rst:61 msgid "The function accepts any :term:`awaitable` object." msgstr "" #: ../../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 "" #: ../../library/asyncio-future.rst:71 msgid "" "Wrap a :class:`concurrent.futures.Future` object in a :class:`asyncio." "Future` object." msgstr "" #: ../../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 "" #: ../../library/asyncio-future.rst:81 msgid "Future Object" msgstr "" #: ../../library/asyncio-future.rst:85 msgid "" "A Future represents an eventual result of an asynchronous operation. Not " "thread-safe." msgstr "" #: ../../library/asyncio-future.rst:88 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:93 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 "" #: ../../library/asyncio-future.rst:98 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 "" #: ../../library/asyncio-future.rst:104 msgid "Futures are :ref:`generic ` over the type of their results." msgstr "" #: ../../library/asyncio-future.rst:106 msgid "Added support for the :mod:`contextvars` module." msgstr "" #: ../../library/asyncio-future.rst:109 msgid "" "Deprecation warning is emitted if *loop* is not specified and there is no " "running event loop." msgstr "" #: ../../library/asyncio-future.rst:115 msgid "Return the result of the Future." msgstr "" #: ../../library/asyncio-future.rst:117 msgid "" "If the Future is *done* and has a result set by the :meth:`set_result` " "method, the result value is returned." msgstr "" #: ../../library/asyncio-future.rst:120 msgid "" "If the Future is *done* and has an exception set by the :meth:" "`set_exception` method, this method raises the exception." msgstr "" #: ../../library/asyncio-future.rst:123 ../../library/asyncio-future.rst:215 msgid "" "If the Future has been *cancelled*, this method raises a :exc:" "`CancelledError` exception." msgstr "" #: ../../library/asyncio-future.rst:126 msgid "" "If the Future's result isn't yet available, this method raises an :exc:" "`InvalidStateError` exception." msgstr "" #: ../../library/asyncio-future.rst:131 msgid "Mark the Future as *done* and set its result." msgstr "" #: ../../library/asyncio-future.rst:133 ../../library/asyncio-future.rst:140 msgid "" "Raises an :exc:`InvalidStateError` error if the Future is already *done*." msgstr "" #: ../../library/asyncio-future.rst:138 msgid "Mark the Future as *done* and set an exception." msgstr "" #: ../../library/asyncio-future.rst:145 msgid "Return ``True`` if the Future is *done*." msgstr "" #: ../../library/asyncio-future.rst:147 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 "" #: ../../library/asyncio-future.rst:153 msgid "Return ``True`` if the Future was *cancelled*." msgstr "" #: ../../library/asyncio-future.rst:155 msgid "" "The method is usually used to check if a Future is not *cancelled* before " "setting a result or an exception for it::" msgstr "" #: ../../library/asyncio-future.rst:158 msgid "" "if not fut.cancelled():\n" " fut.set_result(42)" msgstr "" #: ../../library/asyncio-future.rst:163 msgid "Add a callback to be run when the Future is *done*." msgstr "" #: ../../library/asyncio-future.rst:165 msgid "The *callback* is called with the Future object as its only argument." msgstr "" #: ../../library/asyncio-future.rst:168 msgid "" "If the Future is already *done* when this method is called, the callback is " "scheduled with :meth:`loop.call_soon`." msgstr "" #: ../../library/asyncio-future.rst:171 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 "" #: ../../library/asyncio-future.rst:175 msgid "" ":func:`functools.partial` can be used to pass parameters to the callback, e." "g.::" msgstr "" #: ../../library/asyncio-future.rst:178 msgid "" "# Call 'print(\"Future:\", fut)' when \"fut\" is done.\n" "fut.add_done_callback(\n" " functools.partial(print, \"Future:\"))" msgstr "" #: ../../library/asyncio-future.rst:182 msgid "" "The *context* keyword-only parameter was added. See :pep:`567` for more " "details." msgstr "" #: ../../library/asyncio-future.rst:188 msgid "Remove *callback* from the callbacks list." msgstr "" #: ../../library/asyncio-future.rst:190 msgid "" "Returns the number of callbacks removed, which is typically 1, unless a " "callback was added more than once." msgstr "" #: ../../library/asyncio-future.rst:195 msgid "Cancel the Future and schedule callbacks." msgstr "" #: ../../library/asyncio-future.rst:197 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 "" #: ../../library/asyncio-future.rst:201 msgid "" "The optional string argument *msg* is passed as the argument to the :exc:" "`CancelledError` exception raised when a cancelled Future is awaited." msgstr "" #: ../../library/asyncio-future.rst:205 msgid "Added the *msg* parameter." msgstr "" #: ../../library/asyncio-future.rst:210 msgid "Return the exception that was set on this Future." msgstr "" #: ../../library/asyncio-future.rst:212 msgid "" "The exception (or ``None`` if no exception was set) is returned only if the " "Future is *done*." msgstr "" #: ../../library/asyncio-future.rst:218 msgid "" "If the Future isn't *done* yet, this method raises an :exc:" "`InvalidStateError` exception." msgstr "" #: ../../library/asyncio-future.rst:223 msgid "Return the event loop the Future object is bound to." msgstr "" #: ../../library/asyncio-future.rst:230 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 "" #: ../../library/asyncio-future.rst:234 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:265 msgid "" "The Future object was designed to mimic :class:`concurrent.futures.Future`. " "Key differences include:" msgstr "" #: ../../library/asyncio-future.rst:268 msgid "" "unlike asyncio Futures, :class:`concurrent.futures.Future` instances cannot " "be awaited." msgstr "" #: ../../library/asyncio-future.rst:271 msgid "" ":meth:`asyncio.Future.result` and :meth:`asyncio.Future.exception` do not " "accept the *timeout* argument." msgstr "" #: ../../library/asyncio-future.rst:274 msgid "" ":meth:`asyncio.Future.result` and :meth:`asyncio.Future.exception` raise an :" "exc:`InvalidStateError` exception when the Future is not *done*." msgstr "" #: ../../library/asyncio-future.rst:278 msgid "" "Callbacks registered with :meth:`asyncio.Future.add_done_callback` are not " "called immediately. They are scheduled with :meth:`loop.call_soon` instead." msgstr "" #: ../../library/asyncio-future.rst:282 msgid "" "asyncio Future is not compatible with the :func:`concurrent.futures.wait` " "and :func:`concurrent.futures.as_completed` functions." msgstr "" #: ../../library/asyncio-future.rst:286 msgid "" ":meth:`asyncio.Future.cancel` accepts an optional ``msg`` argument, but :" "meth:`concurrent.futures.Future.cancel` does not." msgstr ""