python-docs-fr/library/asyncio-dev.po

416 lines
13 KiB
Plaintext
Raw Normal View History

2018-07-04 09:06:45 +00:00
# Copyright (C) 2001-2018, Python Software Foundation
2018-07-04 09:08:42 +00:00
# For licence information, see README file.
2016-10-30 09:46:26 +00:00
#
msgid ""
msgstr ""
"Project-Id-Version: Python 3.6\n"
"Report-Msgid-Bugs-To: \n"
2018-06-28 13:32:56 +00:00
"POT-Creation-Date: 2018-06-28 15:29+0200\n"
2016-10-30 09:46:26 +00:00
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
2018-07-04 09:14:25 +00:00
"Language-Team: FRENCH <traductions@lists.afpy.org>\n"
2017-05-23 22:40:56 +00:00
"Language: fr\n"
2016-10-30 09:46:26 +00:00
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: ../Doc/library/asyncio-dev.rst:6
msgid "Develop with asyncio"
msgstr "Programmer avec asyncio"
#: ../Doc/library/asyncio-dev.rst:8
msgid ""
"Asynchronous programming is different than classical \"sequential\" "
"programming. This page lists common traps and explains how to avoid them."
msgstr ""
#: ../Doc/library/asyncio-dev.rst:15
msgid "Debug mode of asyncio"
msgstr "Mode de débug d'asyncio"
#: ../Doc/library/asyncio-dev.rst:17
msgid ""
"The implementation of :mod:`asyncio` has been written for performance. In "
"order to ease the development of asynchronous code, you may wish to enable "
"*debug mode*."
msgstr ""
#: ../Doc/library/asyncio-dev.rst:21
msgid "To enable all debug checks for an application:"
msgstr "Pour activer toutes les vérification de débug pour une application :"
#: ../Doc/library/asyncio-dev.rst:23
msgid ""
"Enable the asyncio debug mode globally by setting the environment variable :"
2018-06-28 13:32:56 +00:00
"envvar:`PYTHONASYNCIODEBUG` to ``1``, using ``-X dev`` command line option "
"(see the :option:`-X` option), or by calling :meth:`AbstractEventLoop."
2016-10-30 09:46:26 +00:00
"set_debug`."
msgstr ""
2018-06-28 13:32:56 +00:00
#: ../Doc/library/asyncio-dev.rst:27
2016-10-30 09:46:26 +00:00
msgid ""
"Set the log level of the :ref:`asyncio logger <asyncio-logger>` to :py:data:"
"`logging.DEBUG`. For example, call ``logging.basicConfig(level=logging."
"DEBUG)`` at startup."
msgstr ""
2018-06-28 13:32:56 +00:00
#: ../Doc/library/asyncio-dev.rst:30
2016-10-30 09:46:26 +00:00
msgid ""
"Configure the :mod:`warnings` module to display :exc:`ResourceWarning` "
"warnings. For example, use the ``-Wdefault`` command line option of Python "
"to display them."
msgstr ""
2018-06-28 13:32:56 +00:00
#: ../Doc/library/asyncio-dev.rst:34
2016-10-30 09:46:26 +00:00
msgid "Examples debug checks:"
msgstr "Exemples de vérifications de débug :"
2018-06-28 13:32:56 +00:00
#: ../Doc/library/asyncio-dev.rst:36
2016-10-30 09:46:26 +00:00
msgid ""
"Log :ref:`coroutines defined but never \"yielded from\" <asyncio-coroutine-"
"not-scheduled>`"
msgstr ""
2018-06-28 13:32:56 +00:00
#: ../Doc/library/asyncio-dev.rst:38
2016-10-30 09:46:26 +00:00
msgid ""
":meth:`~AbstractEventLoop.call_soon` and :meth:`~AbstractEventLoop.call_at` "
"methods raise an exception if they are called from the wrong thread."
msgstr ""
2018-06-28 13:32:56 +00:00
#: ../Doc/library/asyncio-dev.rst:40
2016-10-30 09:46:26 +00:00
msgid "Log the execution time of the selector"
msgstr "Enregistre le temps d'exécution du sélecteur dans le journal"
2018-06-28 13:32:56 +00:00
#: ../Doc/library/asyncio-dev.rst:41
2016-10-30 09:46:26 +00:00
msgid ""
"Log callbacks taking more than 100 ms to be executed. The :attr:"
"`AbstractEventLoop.slow_callback_duration` attribute is the minimum duration "
"in seconds of \"slow\" callbacks."
msgstr ""
2018-06-28 13:32:56 +00:00
#: ../Doc/library/asyncio-dev.rst:44
2016-10-30 09:46:26 +00:00
msgid ""
":exc:`ResourceWarning` warnings are emitted when transports and event loops "
"are :ref:`not closed explicitly <asyncio-close-transports>`."
msgstr ""
2018-06-28 13:32:56 +00:00
#: ../Doc/library/asyncio-dev.rst:49
msgid ""
"The new ``-X dev`` command line option can now also be used to enable the "
"debug mode."
msgstr ""
#: ../Doc/library/asyncio-dev.rst:54
2016-10-30 09:46:26 +00:00
msgid ""
"The :meth:`AbstractEventLoop.set_debug` method and the :ref:`asyncio logger "
"<asyncio-logger>`."
msgstr ""
2018-06-28 13:32:56 +00:00
#: ../Doc/library/asyncio-dev.rst:59
2016-10-30 09:46:26 +00:00
msgid "Cancellation"
msgstr "Annulation"
2018-06-28 13:32:56 +00:00
#: ../Doc/library/asyncio-dev.rst:61
2016-10-30 09:46:26 +00:00
msgid ""
"Cancellation of tasks is not common in classic programming. In asynchronous "
2017-08-09 22:23:54 +00:00
"programming, not only is it something common, but you have to prepare your "
2016-10-30 09:46:26 +00:00
"code to handle it."
msgstr ""
2018-06-28 13:32:56 +00:00
#: ../Doc/library/asyncio-dev.rst:65
2016-10-30 09:46:26 +00:00
msgid ""
"Futures and tasks can be cancelled explicitly with their :meth:`Future."
"cancel` method. The :func:`wait_for` function cancels the waited task when "
"the timeout occurs. There are many other cases where a task can be cancelled "
"indirectly."
msgstr ""
2018-06-28 13:32:56 +00:00
#: ../Doc/library/asyncio-dev.rst:69
2016-10-30 09:46:26 +00:00
msgid ""
"Don't call :meth:`~Future.set_result` or :meth:`~Future.set_exception` "
"method of :class:`Future` if the future is cancelled: it would fail with an "
"exception. For example, write::"
msgstr ""
2018-06-28 13:32:56 +00:00
#: ../Doc/library/asyncio-dev.rst:76
2016-10-30 09:46:26 +00:00
msgid ""
"Don't schedule directly a call to the :meth:`~Future.set_result` or the :"
"meth:`~Future.set_exception` method of a future with :meth:"
"`AbstractEventLoop.call_soon`: the future can be cancelled before its method "
"is called."
msgstr ""
2018-06-28 13:32:56 +00:00
#: ../Doc/library/asyncio-dev.rst:81
2016-10-30 09:46:26 +00:00
msgid ""
"If you wait for a future, you should check early if the future was cancelled "
"to avoid useless operations. Example::"
msgstr ""
2018-06-28 13:32:56 +00:00
#: ../Doc/library/asyncio-dev.rst:91
2016-10-30 09:46:26 +00:00
msgid "The :func:`shield` function can also be used to ignore cancellation."
msgstr ""
2018-06-28 13:32:56 +00:00
#: ../Doc/library/asyncio-dev.rst:97
2016-10-30 09:46:26 +00:00
msgid "Concurrency and multithreading"
msgstr "Concourrance et *multithreading*"
2018-06-28 13:32:56 +00:00
#: ../Doc/library/asyncio-dev.rst:99
2016-10-30 09:46:26 +00:00
msgid ""
"An event loop runs in a thread and executes all callbacks and tasks in the "
"same thread. While a task is running in the event loop, no other task is "
2018-06-28 13:32:56 +00:00
"running in the same thread. But when the task uses ``await``, the task is "
"suspended and the event loop executes the next task."
2016-10-30 09:46:26 +00:00
msgstr ""
2018-06-28 13:32:56 +00:00
#: ../Doc/library/asyncio-dev.rst:104
2016-10-30 09:46:26 +00:00
msgid ""
"To schedule a callback from a different thread, the :meth:`AbstractEventLoop."
"call_soon_threadsafe` method should be used. Example::"
msgstr ""
2018-06-28 13:32:56 +00:00
#: ../Doc/library/asyncio-dev.rst:109
2016-10-30 09:46:26 +00:00
msgid ""
"Most asyncio objects are not thread safe. You should only worry if you "
"access objects outside the event loop. For example, to cancel a future, "
"don't call directly its :meth:`Future.cancel` method, but::"
msgstr ""
2018-06-28 13:32:56 +00:00
#: ../Doc/library/asyncio-dev.rst:115
2016-10-30 09:46:26 +00:00
msgid ""
"To handle signals and to execute subprocesses, the event loop must be run in "
"the main thread."
msgstr ""
2018-06-28 13:32:56 +00:00
#: ../Doc/library/asyncio-dev.rst:118
2016-10-30 09:46:26 +00:00
msgid ""
"To schedule a coroutine object from a different thread, the :func:"
"`run_coroutine_threadsafe` function should be used. It returns a :class:"
"`concurrent.futures.Future` to access the result::"
msgstr ""
2018-06-28 13:32:56 +00:00
#: ../Doc/library/asyncio-dev.rst:125
2016-10-30 09:46:26 +00:00
msgid ""
"The :meth:`AbstractEventLoop.run_in_executor` method can be used with a "
"thread pool executor to execute a callback in different thread to not block "
"the thread of the event loop."
msgstr ""
2018-06-28 13:32:56 +00:00
#: ../Doc/library/asyncio-dev.rst:131
2016-10-30 09:46:26 +00:00
msgid ""
"The :ref:`Synchronization primitives <asyncio-sync>` section describes ways "
"to synchronize tasks."
msgstr ""
2018-06-28 13:32:56 +00:00
#: ../Doc/library/asyncio-dev.rst:134
2016-10-30 09:46:26 +00:00
msgid ""
"The :ref:`Subprocess and threads <asyncio-subprocess-threads>` section lists "
"asyncio limitations to run subprocesses from different threads."
msgstr ""
2018-06-28 13:32:56 +00:00
#: ../Doc/library/asyncio-dev.rst:143
2016-10-30 09:46:26 +00:00
msgid "Handle blocking functions correctly"
msgstr "Gérer les fonctions bloquantes correctement"
2018-06-28 13:32:56 +00:00
#: ../Doc/library/asyncio-dev.rst:145
2016-10-30 09:46:26 +00:00
msgid ""
"Blocking functions should not be called directly. For example, if a function "
"blocks for 1 second, other tasks are delayed by 1 second which can have an "
"important impact on reactivity."
msgstr ""
2018-06-28 13:32:56 +00:00
#: ../Doc/library/asyncio-dev.rst:149
2016-10-30 09:46:26 +00:00
msgid ""
"For networking and subprocesses, the :mod:`asyncio` module provides high-"
"level APIs like :ref:`protocols <asyncio-protocol>`."
msgstr ""
2018-06-28 13:32:56 +00:00
#: ../Doc/library/asyncio-dev.rst:152
2016-10-30 09:46:26 +00:00
msgid ""
"An executor can be used to run a task in a different thread or even in a "
"different process, to not block the thread of the event loop. See the :meth:"
"`AbstractEventLoop.run_in_executor` method."
msgstr ""
2018-06-28 13:32:56 +00:00
#: ../Doc/library/asyncio-dev.rst:158
2016-10-30 09:46:26 +00:00
msgid ""
"The :ref:`Delayed calls <asyncio-delayed-calls>` section details how the "
"event loop handles time."
msgstr ""
2018-06-28 13:32:56 +00:00
#: ../Doc/library/asyncio-dev.rst:165
2016-10-30 09:46:26 +00:00
msgid "Logging"
msgstr "Journalisation"
2018-06-28 13:32:56 +00:00
#: ../Doc/library/asyncio-dev.rst:167
2016-10-30 09:46:26 +00:00
msgid ""
"The :mod:`asyncio` module logs information with the :mod:`logging` module in "
"the logger ``'asyncio'``."
msgstr ""
2018-06-28 13:32:56 +00:00
#: ../Doc/library/asyncio-dev.rst:170
2016-10-30 09:46:26 +00:00
msgid ""
"The default log level for the :mod:`asyncio` module is :py:data:`logging."
"INFO`. For those not wanting such verbosity from :mod:`asyncio` the log "
"level can be changed. For example, to change the level to :py:data:`logging."
"WARNING`:"
msgstr ""
2018-06-28 13:32:56 +00:00
#: ../Doc/library/asyncio-dev.rst:182
2016-10-30 09:46:26 +00:00
msgid "Detect coroutine objects never scheduled"
msgstr "Détecte les coroutines qui ne sont jamais exécutées"
2018-06-28 13:32:56 +00:00
#: ../Doc/library/asyncio-dev.rst:184
2016-10-30 09:46:26 +00:00
msgid ""
"When a coroutine function is called and its result is not passed to :func:"
"`ensure_future` or to the :meth:`AbstractEventLoop.create_task` method, the "
"execution of the coroutine object will never be scheduled which is probably "
"a bug. :ref:`Enable the debug mode of asyncio <asyncio-debug-mode>` to :ref:"
"`log a warning <asyncio-logger>` to detect it."
msgstr ""
2018-06-28 13:32:56 +00:00
#: ../Doc/library/asyncio-dev.rst:190
2016-10-30 09:46:26 +00:00
msgid "Example with the bug::"
msgstr "Exemple avec le bug : ::"
2018-06-28 13:32:56 +00:00
#: ../Doc/library/asyncio-dev.rst:199
2016-10-30 09:46:26 +00:00
msgid "Output in debug mode::"
msgstr "Affichage en mode débug : ::"
2018-06-28 13:32:56 +00:00
#: ../Doc/library/asyncio-dev.rst:206
2016-10-30 09:46:26 +00:00
msgid ""
"The fix is to call the :func:`ensure_future` function or the :meth:"
"`AbstractEventLoop.create_task` method with the coroutine object."
msgstr ""
2018-06-28 13:32:56 +00:00
#: ../Doc/library/asyncio-dev.rst:211
2016-10-30 09:46:26 +00:00
msgid ":ref:`Pending task destroyed <asyncio-pending-task-destroyed>`."
msgstr ""
2018-06-28 13:32:56 +00:00
#: ../Doc/library/asyncio-dev.rst:215
2016-10-30 09:46:26 +00:00
msgid "Detect exceptions never consumed"
msgstr ""
2018-06-28 13:32:56 +00:00
#: ../Doc/library/asyncio-dev.rst:217
2016-10-30 09:46:26 +00:00
msgid ""
2017-12-01 06:48:13 +00:00
"Python usually calls :func:`sys.excepthook` on unhandled exceptions. If :"
2016-10-30 09:46:26 +00:00
"meth:`Future.set_exception` is called, but the exception is never consumed, :"
2017-12-01 06:48:13 +00:00
"func:`sys.excepthook` is not called. Instead, :ref:`a log is emitted "
2016-10-30 09:46:26 +00:00
"<asyncio-logger>` when the future is deleted by the garbage collector, with "
"the traceback where the exception was raised."
msgstr ""
2018-06-28 13:32:56 +00:00
#: ../Doc/library/asyncio-dev.rst:223
2016-10-30 09:46:26 +00:00
msgid "Example of unhandled exception::"
msgstr ""
2018-06-28 13:32:56 +00:00
#: ../Doc/library/asyncio-dev.rst:236
2016-10-30 09:46:26 +00:00
msgid "Output::"
msgstr "Sortie ::"
2016-10-30 09:46:26 +00:00
2018-06-28 13:32:56 +00:00
#: ../Doc/library/asyncio-dev.rst:249
2016-10-30 09:46:26 +00:00
msgid ""
":ref:`Enable the debug mode of asyncio <asyncio-debug-mode>` to get the "
"traceback where the task was created. Output in debug mode::"
msgstr ""
2018-06-28 13:32:56 +00:00
#: ../Doc/library/asyncio-dev.rst:268
2016-10-30 09:46:26 +00:00
msgid ""
"There are different options to fix this issue. The first option is to chain "
"the coroutine in another coroutine and use classic try/except::"
msgstr ""
2018-06-28 13:32:56 +00:00
#: ../Doc/library/asyncio-dev.rst:282
2016-10-30 09:46:26 +00:00
msgid ""
"Another option is to use the :meth:`AbstractEventLoop.run_until_complete` "
"function::"
msgstr ""
2018-06-28 13:32:56 +00:00
#: ../Doc/library/asyncio-dev.rst:293
2016-10-30 09:46:26 +00:00
msgid "The :meth:`Future.exception` method."
msgstr "La méthode :meth:`Future.exception`."
2018-06-28 13:32:56 +00:00
#: ../Doc/library/asyncio-dev.rst:297
2016-10-30 09:46:26 +00:00
msgid "Chain coroutines correctly"
msgstr "Chaîner les coroutines correctement"
2018-06-28 13:32:56 +00:00
#: ../Doc/library/asyncio-dev.rst:299
2016-10-30 09:46:26 +00:00
msgid ""
"When a coroutine function calls other coroutine functions and tasks, they "
2018-06-28 13:32:56 +00:00
"should be chained explicitly with ``await``. Otherwise, the execution is not "
"guaranteed to be sequential."
2016-10-30 09:46:26 +00:00
msgstr ""
2018-06-28 13:32:56 +00:00
#: ../Doc/library/asyncio-dev.rst:303
2016-10-30 09:46:26 +00:00
msgid ""
"Example with different bugs using :func:`asyncio.sleep` to simulate slow "
"operations::"
msgstr ""
#: ../Doc/library/asyncio-dev.rst:332
msgid "Expected output:"
msgstr ""
#: ../Doc/library/asyncio-dev.rst:341
msgid "Actual output:"
msgstr "Affichage obtenu :"
#: ../Doc/library/asyncio-dev.rst:351
msgid ""
"The loop stopped before the ``create()`` finished, ``close()`` has been "
"called before ``write()``, whereas coroutine functions were called in this "
"order: ``create()``, ``write()``, ``close()``."
msgstr ""
#: ../Doc/library/asyncio-dev.rst:355
2018-06-28 13:32:56 +00:00
msgid "To fix the example, tasks must be marked with ``await``::"
2016-10-30 09:46:26 +00:00
msgstr ""
2018-06-28 13:32:56 +00:00
#: ../Doc/library/asyncio-dev.rst:364
2016-10-30 09:46:26 +00:00
msgid "Or without ``asyncio.ensure_future()``::"
msgstr "Ou sans ``asyncio.ensure_future()`` ::"
2016-10-30 09:46:26 +00:00
2018-06-28 13:32:56 +00:00
#: ../Doc/library/asyncio-dev.rst:377
2016-10-30 09:46:26 +00:00
msgid "Pending task destroyed"
msgstr ""
2018-06-28 13:32:56 +00:00
#: ../Doc/library/asyncio-dev.rst:379
2016-10-30 09:46:26 +00:00
msgid ""
"If a pending task is destroyed, the execution of its wrapped :ref:`coroutine "
"<coroutine>` did not complete. It is probably a bug and so a warning is "
"logged."
msgstr ""
2018-06-28 13:32:56 +00:00
#: ../Doc/library/asyncio-dev.rst:382
2016-10-30 09:46:26 +00:00
msgid "Example of log:"
msgstr ""
2018-06-28 13:32:56 +00:00
#: ../Doc/library/asyncio-dev.rst:389
2016-10-30 09:46:26 +00:00
msgid ""
":ref:`Enable the debug mode of asyncio <asyncio-debug-mode>` to get the "
"traceback where the task was created. Example of log in debug mode:"
msgstr ""
2018-06-28 13:32:56 +00:00
#: ../Doc/library/asyncio-dev.rst:403
2016-10-30 09:46:26 +00:00
msgid ""
":ref:`Detect coroutine objects never scheduled <asyncio-coroutine-not-"
"scheduled>`."
msgstr ""
2018-06-28 13:32:56 +00:00
#: ../Doc/library/asyncio-dev.rst:408
2016-10-30 09:46:26 +00:00
msgid "Close transports and event loops"
msgstr ""
2018-06-28 13:32:56 +00:00
#: ../Doc/library/asyncio-dev.rst:410
2016-10-30 09:46:26 +00:00
msgid ""
"When a transport is no more needed, call its ``close()`` method to release "
"resources. Event loops must also be closed explicitly."
msgstr ""
2018-06-28 13:32:56 +00:00
#: ../Doc/library/asyncio-dev.rst:413
2016-10-30 09:46:26 +00:00
msgid ""
"If a transport or an event loop is not closed explicitly, a :exc:"
"`ResourceWarning` warning will be emitted in its destructor. By default, :"
"exc:`ResourceWarning` warnings are ignored. The :ref:`Debug mode of asyncio "
"<asyncio-debug-mode>` section explains how to display them."
msgstr ""