forked from AFPy/python-docs-fr
Complete library/contextlib.po (#961)
This commit is contained in:
parent
ce415890bd
commit
4c75c93ace
3
dict
3
dict
|
@ -67,6 +67,7 @@ itérateurs
|
||||||
ı
|
ı
|
||||||
journalise
|
journalise
|
||||||
journalisé
|
journalisé
|
||||||
|
journalisée
|
||||||
journaliser
|
journaliser
|
||||||
journalisés
|
journalisés
|
||||||
journaliseur
|
journaliseur
|
||||||
|
@ -110,6 +111,8 @@ Pylint
|
||||||
PythonWin
|
PythonWin
|
||||||
recompilation
|
recompilation
|
||||||
Reedy
|
Reedy
|
||||||
|
réentrant
|
||||||
|
réentrante
|
||||||
réentrants
|
réentrants
|
||||||
réessayable
|
réessayable
|
||||||
réexécuter
|
réexécuter
|
||||||
|
|
|
@ -6,18 +6,21 @@ msgstr ""
|
||||||
"Project-Id-Version: Python 3.6\n"
|
"Project-Id-Version: Python 3.6\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2018-12-21 09:48+0100\n"
|
"POT-Creation-Date: 2018-12-21 09:48+0100\n"
|
||||||
"PO-Revision-Date: 2018-07-04 11:33+0200\n"
|
"PO-Revision-Date: 2019-12-01 23:39+0100\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
|
||||||
"Language-Team: FRENCH <traductions@lists.afpy.org>\n"
|
"Language-Team: FRENCH <traductions@lists.afpy.org>\n"
|
||||||
"Language: fr\n"
|
"Language: fr\n"
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"Last-Translator: \n"
|
||||||
|
"X-Generator: Poedit 2.2.1\n"
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:2
|
#: ../Doc/library/contextlib.rst:2
|
||||||
msgid ""
|
msgid ""
|
||||||
":mod:`!contextlib` --- Utilities for :keyword:`!with`\\ -statement contexts"
|
":mod:`!contextlib` --- Utilities for :keyword:`!with`\\ -statement contexts"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
":mod:`!contextlib` — Utilitaires pour les contextes s'appuyant sur "
|
||||||
|
"l'instruction :keyword:`!with`"
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:7
|
#: ../Doc/library/contextlib.rst:7
|
||||||
msgid "**Source code:** :source:`Lib/contextlib.py`"
|
msgid "**Source code:** :source:`Lib/contextlib.py`"
|
||||||
|
@ -29,6 +32,9 @@ msgid ""
|
||||||
"`with` statement. For more information see also :ref:`typecontextmanager` "
|
"`with` statement. For more information see also :ref:`typecontextmanager` "
|
||||||
"and :ref:`context-managers`."
|
"and :ref:`context-managers`."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Ce module fournit des utilitaires pour les tâches impliquant le mot-clé :"
|
||||||
|
"keyword:`with`. Pour plus d'informations voir aussi :ref:"
|
||||||
|
"`typecontextmanager` et :ref:`context-managers`."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:17
|
#: ../Doc/library/contextlib.rst:17
|
||||||
msgid "Utilities"
|
msgid "Utilities"
|
||||||
|
@ -36,7 +42,7 @@ msgstr "Utilitaires"
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:19
|
#: ../Doc/library/contextlib.rst:19
|
||||||
msgid "Functions and classes provided:"
|
msgid "Functions and classes provided:"
|
||||||
msgstr ""
|
msgstr "Fonctions et classes fournies :"
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:23
|
#: ../Doc/library/contextlib.rst:23
|
||||||
msgid ""
|
msgid ""
|
||||||
|
@ -46,6 +52,12 @@ msgid ""
|
||||||
"__exit__` is an abstract method which by default returns ``None``. See also "
|
"__exit__` is an abstract method which by default returns ``None``. See also "
|
||||||
"the definition of :ref:`typecontextmanager`."
|
"the definition of :ref:`typecontextmanager`."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
":term:`Classe mère abstraite <abstract base class>` pour les classes qui "
|
||||||
|
"implémentent les méthodes :meth:`object.__enter__` et :meth:`object."
|
||||||
|
"__exit__`. Une implémentation par défaut de :meth:`object.__enter__` est "
|
||||||
|
"fournie, qui renvoie ``self``, et :meth:`object.__exit__` est une méthode "
|
||||||
|
"abstraite qui renvoie ``None`` par défaut. Voir aussi la définition de :ref:"
|
||||||
|
"`typecontextmanager`."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:34
|
#: ../Doc/library/contextlib.rst:34
|
||||||
msgid ""
|
msgid ""
|
||||||
|
@ -55,6 +67,12 @@ msgid ""
|
||||||
"__aexit__` is an abstract method which by default returns ``None``. See also "
|
"__aexit__` is an abstract method which by default returns ``None``. See also "
|
||||||
"the definition of :ref:`async-context-managers`."
|
"the definition of :ref:`async-context-managers`."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
":term:`Classe mère abstraite <abstract base class>` pour les classes qui "
|
||||||
|
"implémentent les méthodes :meth:`object.__aenter__` et :meth:`object."
|
||||||
|
"__aexit__`. Une implémentation par défaut de :meth:`object.__aenter__` est "
|
||||||
|
"fournie, qui renvoie ``self``, et :meth:`object.__aexit__` est une méthode "
|
||||||
|
"abstraite qui renvoie ``None`` par défaut. Voir aussi la définition de :ref:"
|
||||||
|
"`async-context-managers`."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:46
|
#: ../Doc/library/contextlib.rst:46
|
||||||
msgid ""
|
msgid ""
|
||||||
|
@ -62,6 +80,10 @@ msgid ""
|
||||||
"function for :keyword:`with` statement context managers, without needing to "
|
"function for :keyword:`with` statement context managers, without needing to "
|
||||||
"create a class or separate :meth:`__enter__` and :meth:`__exit__` methods."
|
"create a class or separate :meth:`__enter__` and :meth:`__exit__` methods."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Cette fonction est un :term:`decorator` qui peut être utilisé pour définir "
|
||||||
|
"une fonction fabriquant des gestionnaires de contexte à utiliser avec :"
|
||||||
|
"keyword:`with`, sans nécessiter de créer une classe ou des méthodes :meth:"
|
||||||
|
"`__enter__` et :meth:`__exit__` séparées."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:50
|
#: ../Doc/library/contextlib.rst:50
|
||||||
msgid ""
|
msgid ""
|
||||||
|
@ -70,19 +92,30 @@ msgid ""
|
||||||
"and doesn't implement a ``close()`` method for use with ``contextlib."
|
"and doesn't implement a ``close()`` method for use with ``contextlib."
|
||||||
"closing``"
|
"closing``"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Alors que de nombreux objets s'utilisent nativement dans des blocs *with*, "
|
||||||
|
"on trouve parfois des ressources qui nécessitent d'être gérées mais ne sont "
|
||||||
|
"pas des gestionnaires de contextes, et qui n'implémentent pas de méthode "
|
||||||
|
"``close()`` pour pouvoir être utilisées avec ``contextlib.closing``"
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:54
|
#: ../Doc/library/contextlib.rst:54
|
||||||
msgid ""
|
msgid ""
|
||||||
"An abstract example would be the following to ensure correct resource "
|
"An abstract example would be the following to ensure correct resource "
|
||||||
"management::"
|
"management::"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"L'exemple abstrait suivant présente comment assurer une gestion correcte des "
|
||||||
|
"ressources ::"
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:73
|
#: ../Doc/library/contextlib.rst:73
|
||||||
|
#, fuzzy
|
||||||
msgid ""
|
msgid ""
|
||||||
"The function being decorated must return a :term:`generator`-iterator when "
|
"The function being decorated must return a :term:`generator`-iterator when "
|
||||||
"called. This iterator must yield exactly one value, which will be bound to "
|
"called. This iterator must yield exactly one value, which will be bound to "
|
||||||
"the targets in the :keyword:`with` statement's :keyword:`!as` clause, if any."
|
"the targets in the :keyword:`with` statement's :keyword:`!as` clause, if any."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"La fonction à décorer doit renvoyer un :term:`générateur-itérateur "
|
||||||
|
"<generator-iterator>` quand elle est appelée. Ce générateur ne doit produire "
|
||||||
|
"qu'une seule valeur, qui est récupérée dans le bloc :keyword:`with` à l'aide "
|
||||||
|
"de la clause :keyword:`!as` si précisée."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:77
|
#: ../Doc/library/contextlib.rst:77
|
||||||
msgid ""
|
msgid ""
|
||||||
|
@ -99,6 +132,18 @@ msgid ""
|
||||||
"handled, and execution will resume with the statement immediately following "
|
"handled, and execution will resume with the statement immediately following "
|
||||||
"the :keyword:`!with` statement."
|
"the :keyword:`!with` statement."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Au moment où le générateur produit une valeur, le bloc imbriqué sous "
|
||||||
|
"l'instruction :keyword:`with` est exécuté. Le générateur est ensuite repris "
|
||||||
|
"après la sortie du bloc. Si une exception non gérée survient dans le bloc, "
|
||||||
|
"elle est relayée dans le générateur au niveau de l'instruction *yield*. "
|
||||||
|
"Ainsi, vous pouvez utiliser les instructions :keyword:`try`…\\ :keyword:"
|
||||||
|
"`except`…\\ :keyword:`finally` pour attraper l'erreur (s'il y a), ou vous "
|
||||||
|
"assurer qu'un nettoyage a bien lieu. Si une exception est attrapée dans "
|
||||||
|
"l'unique but d'être journalisée ou d'effectuer une action particulière "
|
||||||
|
"(autre que supprimer entièrement l'exception), le générateur se doit de la "
|
||||||
|
"relayer. Autrement le générateur gestionnaire de contexte doit indiquer à "
|
||||||
|
"l'instruction :keyword:`!with` que l'exception a été gérée, et l'exécution "
|
||||||
|
"reprend sur l'instruction qui suit directement le bloc :keyword:`!with`."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:89
|
#: ../Doc/library/contextlib.rst:89
|
||||||
msgid ""
|
msgid ""
|
||||||
|
@ -110,16 +155,26 @@ msgid ""
|
||||||
"that context managers support multiple invocations in order to be used as "
|
"that context managers support multiple invocations in order to be used as "
|
||||||
"decorators)."
|
"decorators)."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Le décorateur :func:`contextmanager` utilise la classe :class:"
|
||||||
|
"`ContextDecorator` afin que les gestionnaires de contexte qu'il crée "
|
||||||
|
"puissent être utilisés aussi bien en tant que décorateurs qu'avec des "
|
||||||
|
"instructions :keyword:`with`. Quand vous l'utilisez comme décorateur, une "
|
||||||
|
"nouvelle instance du générateur est créée à chaque appel de la fonction "
|
||||||
|
"(cela permet aux gestionnaires de contexte à usage unique créés par :func:"
|
||||||
|
"`contextmanager` de remplir la condition de pouvoir être invoqués plusieurs "
|
||||||
|
"fois afin d'être utilisés comme décorateurs)."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:96
|
#: ../Doc/library/contextlib.rst:96
|
||||||
msgid "Use of :class:`ContextDecorator`."
|
msgid "Use of :class:`ContextDecorator`."
|
||||||
msgstr ""
|
msgstr "Utilisation de la classe :class:`ContextDecorator`."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:102
|
#: ../Doc/library/contextlib.rst:102
|
||||||
msgid ""
|
msgid ""
|
||||||
"Similar to :func:`~contextlib.contextmanager`, but creates an :ref:"
|
"Similar to :func:`~contextlib.contextmanager`, but creates an :ref:"
|
||||||
"`asynchronous context manager <async-context-managers>`."
|
"`asynchronous context manager <async-context-managers>`."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Similaire à :func:`~contextlib.contextmanager`, mais crée un :ref:"
|
||||||
|
"`gestionnaire de contexte asynchrone <async-context-managers>`."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:105
|
#: ../Doc/library/contextlib.rst:105
|
||||||
msgid ""
|
msgid ""
|
||||||
|
@ -129,6 +184,12 @@ msgid ""
|
||||||
"`__aexit__` methods. It must be applied to an :term:`asynchronous generator` "
|
"`__aexit__` methods. It must be applied to an :term:`asynchronous generator` "
|
||||||
"function."
|
"function."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Cette fonction est un :term:`decorator` qui peut être utilisé pour définir "
|
||||||
|
"une fonction fabriquant des gestionnaires de contexte asynchrones à utiliser "
|
||||||
|
"avec :keyword:`async with`, sans nécessiter de créer une classe ou des "
|
||||||
|
"méthodes :meth:`__aenter__` et :meth:`__aexit__` séparées. Le décorateur "
|
||||||
|
"doit être appliqué à une fonction renvoyant un :term:`asynchronous "
|
||||||
|
"generator`."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:111
|
#: ../Doc/library/contextlib.rst:111
|
||||||
msgid "A simple example::"
|
msgid "A simple example::"
|
||||||
|
@ -139,16 +200,20 @@ msgid ""
|
||||||
"Return a context manager that closes *thing* upon completion of the block. "
|
"Return a context manager that closes *thing* upon completion of the block. "
|
||||||
"This is basically equivalent to::"
|
"This is basically equivalent to::"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Renvoie un gestionnaire de contexte qui ferme *thing* à la fin du bloc. "
|
||||||
|
"C'est essentiellement équivalent à ::"
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:144
|
#: ../Doc/library/contextlib.rst:144
|
||||||
msgid "And lets you write code like this::"
|
msgid "And lets you write code like this::"
|
||||||
msgstr ""
|
msgstr "Et cela vous permet d'écrire du code tel que ::"
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:153
|
#: ../Doc/library/contextlib.rst:153
|
||||||
msgid ""
|
msgid ""
|
||||||
"without needing to explicitly close ``page``. Even if an error occurs, "
|
"without needing to explicitly close ``page``. Even if an error occurs, "
|
||||||
"``page.close()`` will be called when the :keyword:`with` block is exited."
|
"``page.close()`` will be called when the :keyword:`with` block is exited."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"sans besoin de fermer explicitement ``page``. Même si une erreur survient, "
|
||||||
|
"``page.close()`` est appelée à la fermeture du bloc :keyword:`with`."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:161
|
#: ../Doc/library/contextlib.rst:161
|
||||||
msgid ""
|
msgid ""
|
||||||
|
@ -156,10 +221,13 @@ msgid ""
|
||||||
"otherwise does nothing. It is intended to be used as a stand-in for an "
|
"otherwise does nothing. It is intended to be used as a stand-in for an "
|
||||||
"optional context manager, for example::"
|
"optional context manager, for example::"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Renvoie un gestionnaire de contexte dont la méthode ``__enter__`` renvoie "
|
||||||
|
"*enter_result*, mais ne fait rien d'autre. L'idée est de l'utiliser comme "
|
||||||
|
"remplaçant pour un gestionnaire de contexte optionnel, par exemple ::"
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:175
|
#: ../Doc/library/contextlib.rst:175
|
||||||
msgid "An example using *enter_result*::"
|
msgid "An example using *enter_result*::"
|
||||||
msgstr ""
|
msgstr "Un exemple utilisant *enter_result* ::"
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:193
|
#: ../Doc/library/contextlib.rst:193
|
||||||
msgid ""
|
msgid ""
|
||||||
|
@ -167,6 +235,9 @@ msgid ""
|
||||||
"they occur in the body of a with statement and then resumes execution with "
|
"they occur in the body of a with statement and then resumes execution with "
|
||||||
"the first statement following the end of the with statement."
|
"the first statement following the end of the with statement."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Renvoie un gestionnaire de contexte qui supprime toutes les exceptions "
|
||||||
|
"spécifiées si elles surviennent dans le corps du bloc *with*, et reprend "
|
||||||
|
"l'exécution sur la première instruction qui suit la fin du bloc *with*."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:197
|
#: ../Doc/library/contextlib.rst:197
|
||||||
msgid ""
|
msgid ""
|
||||||
|
@ -175,6 +246,10 @@ msgid ""
|
||||||
"silently continuing with program execution is known to be the right thing to "
|
"silently continuing with program execution is known to be the right thing to "
|
||||||
"do."
|
"do."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Comme pour tous les mécanismes qui suppriment complètement les exceptions, "
|
||||||
|
"ce gestionnaire de contexte doit seulement être utilisé pour couvrir des cas "
|
||||||
|
"très spécifiques d'erreurs où il est certain que continuer silencieusement "
|
||||||
|
"l'exécution du programme est la bonne chose à faire."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:202
|
#: ../Doc/library/contextlib.rst:202
|
||||||
msgid "For example::"
|
msgid "For example::"
|
||||||
|
@ -187,19 +262,23 @@ msgstr "Ce code est équivalent à ::"
|
||||||
#: ../Doc/library/contextlib.rst:224 ../Doc/library/contextlib.rst:263
|
#: ../Doc/library/contextlib.rst:224 ../Doc/library/contextlib.rst:263
|
||||||
#: ../Doc/library/contextlib.rst:273
|
#: ../Doc/library/contextlib.rst:273
|
||||||
msgid "This context manager is :ref:`reentrant <reentrant-cms>`."
|
msgid "This context manager is :ref:`reentrant <reentrant-cms>`."
|
||||||
msgstr ""
|
msgstr "Ce gestionnaire de contexte est :ref:`réentrant <reentrant-cms>`."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:231
|
#: ../Doc/library/contextlib.rst:231
|
||||||
msgid ""
|
msgid ""
|
||||||
"Context manager for temporarily redirecting :data:`sys.stdout` to another "
|
"Context manager for temporarily redirecting :data:`sys.stdout` to another "
|
||||||
"file or file-like object."
|
"file or file-like object."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Gestionnaire de contexte servant à rediriger temporairement :data:`sys."
|
||||||
|
"stdout` vers un autre fichier ou objet fichier-compatible."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:234
|
#: ../Doc/library/contextlib.rst:234
|
||||||
msgid ""
|
msgid ""
|
||||||
"This tool adds flexibility to existing functions or classes whose output is "
|
"This tool adds flexibility to existing functions or classes whose output is "
|
||||||
"hardwired to stdout."
|
"hardwired to stdout."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Cet outil ajoute une certaine flexibilité aux fonctions ou classes "
|
||||||
|
"existantes dont la sortie est envoyée vers la sortie standard."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:237
|
#: ../Doc/library/contextlib.rst:237
|
||||||
msgid ""
|
msgid ""
|
||||||
|
@ -207,16 +286,21 @@ msgid ""
|
||||||
"You can capture that output in a string by redirecting the output to an :"
|
"You can capture that output in a string by redirecting the output to an :"
|
||||||
"class:`io.StringIO` object::"
|
"class:`io.StringIO` object::"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Par exemple, la sortie de :func:`help` est normalement envoyée vers *sys."
|
||||||
|
"stdout*. Vous pouvez capturer cette sortie dans une chaîne de caractères en "
|
||||||
|
"la redirigeant vers un objet :class:`io.StringIO` ::"
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:246
|
#: ../Doc/library/contextlib.rst:246
|
||||||
msgid ""
|
msgid ""
|
||||||
"To send the output of :func:`help` to a file on disk, redirect the output to "
|
"To send the output of :func:`help` to a file on disk, redirect the output to "
|
||||||
"a regular file::"
|
"a regular file::"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Pour envoyer la sortie de :func:`help` vers un fichier sur le disque, "
|
||||||
|
"redirigez-la sur un fichier normal ::"
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:253
|
#: ../Doc/library/contextlib.rst:253
|
||||||
msgid "To send the output of :func:`help` to *sys.stderr*::"
|
msgid "To send the output of :func:`help` to *sys.stderr*::"
|
||||||
msgstr ""
|
msgstr "Pour envoyer la sortie de :func:`help` sur *sys.stderr* ::"
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:258
|
#: ../Doc/library/contextlib.rst:258
|
||||||
msgid ""
|
msgid ""
|
||||||
|
@ -225,17 +309,27 @@ msgid ""
|
||||||
"applications. It also has no effect on the output of subprocesses. However, "
|
"applications. It also has no effect on the output of subprocesses. However, "
|
||||||
"it is still a useful approach for many utility scripts."
|
"it is still a useful approach for many utility scripts."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Notez que l'effet de bord global sur :data:`sys.stdout` signifie que ce "
|
||||||
|
"gestionnaire de contexte n'est pas adapté à une utilisation dans le code "
|
||||||
|
"d'une bibliothèque ni dans la plupart des applications à plusieurs fils "
|
||||||
|
"d'exécution. Aussi, cela n'a pas d'effet sur la sortie des sous-processus. "
|
||||||
|
"Cependant, cela reste une approche utile pour beaucoup de scripts "
|
||||||
|
"utilitaires."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:270
|
#: ../Doc/library/contextlib.rst:270
|
||||||
msgid ""
|
msgid ""
|
||||||
"Similar to :func:`~contextlib.redirect_stdout` but redirecting :data:`sys."
|
"Similar to :func:`~contextlib.redirect_stdout` but redirecting :data:`sys."
|
||||||
"stderr` to another file or file-like object."
|
"stderr` to another file or file-like object."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Similaire à :func:`~contextlib.redirect_stdout` mais redirige :data:`sys."
|
||||||
|
"stderr` vers un autre fichier ou objet fichier-compatible."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:280
|
#: ../Doc/library/contextlib.rst:280
|
||||||
msgid ""
|
msgid ""
|
||||||
"A base class that enables a context manager to also be used as a decorator."
|
"A base class that enables a context manager to also be used as a decorator."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Une classe mère qui permet à un gestionnaire de contexte d'être aussi "
|
||||||
|
"utilisé comme décorateur."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:282
|
#: ../Doc/library/contextlib.rst:282
|
||||||
msgid ""
|
msgid ""
|
||||||
|
@ -243,37 +337,50 @@ msgid ""
|
||||||
"``__enter__`` and ``__exit__`` as normal. ``__exit__`` retains its optional "
|
"``__enter__`` and ``__exit__`` as normal. ``__exit__`` retains its optional "
|
||||||
"exception handling even when used as a decorator."
|
"exception handling even when used as a decorator."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Les gestionnaires de contexte héritant de ``ContextDecorator`` doivent "
|
||||||
|
"implémenter ``__enter__`` et ``__exit__`` comme habituellement. ``__exit__`` "
|
||||||
|
"conserve sa gestion optionnelle des exceptions même lors de l'utilisation en "
|
||||||
|
"décorateur."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:286
|
#: ../Doc/library/contextlib.rst:286
|
||||||
msgid ""
|
msgid ""
|
||||||
"``ContextDecorator`` is used by :func:`contextmanager`, so you get this "
|
"``ContextDecorator`` is used by :func:`contextmanager`, so you get this "
|
||||||
"functionality automatically."
|
"functionality automatically."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"``ContextDecorator`` est utilisé par :func:`contextmanager`, donc vous "
|
||||||
|
"bénéficiez automatiquement de cette fonctionnalité."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:289
|
#: ../Doc/library/contextlib.rst:289
|
||||||
msgid "Example of ``ContextDecorator``::"
|
msgid "Example of ``ContextDecorator``::"
|
||||||
msgstr ""
|
msgstr "Exemple de ``ContextDecorator`` ::"
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:318
|
#: ../Doc/library/contextlib.rst:318
|
||||||
msgid ""
|
msgid ""
|
||||||
"This change is just syntactic sugar for any construct of the following form::"
|
"This change is just syntactic sugar for any construct of the following form::"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Ce changement est simplement un sucre syntaxique pour les constructions de "
|
||||||
|
"la forme suivante ::"
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:324
|
#: ../Doc/library/contextlib.rst:324
|
||||||
msgid "``ContextDecorator`` lets you instead write::"
|
msgid "``ContextDecorator`` lets you instead write::"
|
||||||
msgstr ""
|
msgstr "``ContextDecorator`` vous permet d'écrire à la place ::"
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:330
|
#: ../Doc/library/contextlib.rst:330
|
||||||
msgid ""
|
msgid ""
|
||||||
"It makes it clear that the ``cm`` applies to the whole function, rather than "
|
"It makes it clear that the ``cm`` applies to the whole function, rather than "
|
||||||
"just a piece of it (and saving an indentation level is nice, too)."
|
"just a piece of it (and saving an indentation level is nice, too)."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Cela éclaircit le fait que ``cm`` s'applique à la fonction entière, et pas "
|
||||||
|
"seulement à un morceau en particulier (et gagner un niveau d'indentation est "
|
||||||
|
"toujours appréciable)."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:333
|
#: ../Doc/library/contextlib.rst:333
|
||||||
msgid ""
|
msgid ""
|
||||||
"Existing context managers that already have a base class can be extended by "
|
"Existing context managers that already have a base class can be extended by "
|
||||||
"using ``ContextDecorator`` as a mixin class::"
|
"using ``ContextDecorator`` as a mixin class::"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Les gestionnaires de contexte existants qui ont déjà une classe mère peuvent "
|
||||||
|
"être étendus en utilisant ``ContextDecorator`` comme une *mixin* ::"
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:346
|
#: ../Doc/library/contextlib.rst:346
|
||||||
msgid ""
|
msgid ""
|
||||||
|
@ -282,6 +389,11 @@ msgid ""
|
||||||
"statements. If this is not the case, then the original construct with the "
|
"statements. If this is not the case, then the original construct with the "
|
||||||
"explicit :keyword:`!with` statement inside the function should be used."
|
"explicit :keyword:`!with` statement inside the function should be used."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Comme la fonction décorée doit être capable d'être appelée plusieurs fois, "
|
||||||
|
"le gestionnaire de contexte sous-jacent doit permettre d'être utilisé dans "
|
||||||
|
"de multiples instructions :keyword:`with`. Si ce n'est pas le cas, alors la "
|
||||||
|
"construction d'origine avec de multiples instructions :keyword:`!with` au "
|
||||||
|
"sein de la fonction doit être utilisée."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:356
|
#: ../Doc/library/contextlib.rst:356
|
||||||
msgid ""
|
msgid ""
|
||||||
|
@ -289,12 +401,18 @@ msgid ""
|
||||||
"combine other context managers and cleanup functions, especially those that "
|
"combine other context managers and cleanup functions, especially those that "
|
||||||
"are optional or otherwise driven by input data."
|
"are optional or otherwise driven by input data."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Gestionnaire de contexte conçu pour simplifier le fait de combiner "
|
||||||
|
"programmatiquement d'autres gestionnaires de contexte et fonctions de "
|
||||||
|
"nettoyage, spécifiquement ceux qui sont optionnels ou pilotés par des "
|
||||||
|
"données d'entrée."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:360
|
#: ../Doc/library/contextlib.rst:360
|
||||||
msgid ""
|
msgid ""
|
||||||
"For example, a set of files may easily be handled in a single with statement "
|
"For example, a set of files may easily be handled in a single with statement "
|
||||||
"as follows::"
|
"as follows::"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Par exemple, un ensemble de fichiers peut facilement être géré dans une "
|
||||||
|
"unique instruction *with* comme suit ::"
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:369
|
#: ../Doc/library/contextlib.rst:369
|
||||||
msgid ""
|
msgid ""
|
||||||
|
@ -303,6 +421,11 @@ msgid ""
|
||||||
"at the end of a :keyword:`with` statement). Note that callbacks are *not* "
|
"at the end of a :keyword:`with` statement). Note that callbacks are *not* "
|
||||||
"invoked implicitly when the context stack instance is garbage collected."
|
"invoked implicitly when the context stack instance is garbage collected."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Chaque instance maintient une pile de fonctions de rappels (*callbacks*) "
|
||||||
|
"enregistrées qui sont appelées en ordre inverse quand l'instance est fermée "
|
||||||
|
"(explicitement ou implicitement à la fin d'un bloc :keyword:`with`). Notez "
|
||||||
|
"que ces fonctions ne sont *pas* invoquées implicitement quand l'instance de "
|
||||||
|
"la pile de contextes est collectée par le ramasse-miettes."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:374
|
#: ../Doc/library/contextlib.rst:374
|
||||||
msgid ""
|
msgid ""
|
||||||
|
@ -310,6 +433,9 @@ msgid ""
|
||||||
"resources in their ``__init__`` method (such as file objects) can be handled "
|
"resources in their ``__init__`` method (such as file objects) can be handled "
|
||||||
"correctly."
|
"correctly."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Ce modèle de pile est utilisé afin que les gestionnaires de contexte qui "
|
||||||
|
"acquièrent leurs ressources dans leur méthode ``__init__`` (tels que les "
|
||||||
|
"objets-fichiers) puissent être gérés correctement."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:378
|
#: ../Doc/library/contextlib.rst:378
|
||||||
msgid ""
|
msgid ""
|
||||||
|
@ -320,6 +446,12 @@ msgid ""
|
||||||
"exception, then outer callbacks will be passed arguments based on that "
|
"exception, then outer callbacks will be passed arguments based on that "
|
||||||
"updated state."
|
"updated state."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Comme les fonctions de rappel enregistrées sont invoquées dans l'ordre "
|
||||||
|
"inverse d'enregistrement, cela revient au même que si de multiples blocs :"
|
||||||
|
"keyword:`with` imbriqués avaient été utilisés avec l'ensemble de fonctions "
|
||||||
|
"enregistrées. Cela s'étend aussi à la gestion d'exceptions — si une fonction "
|
||||||
|
"de rappel intérieure supprime ou remplace une exception, alors les fonctions "
|
||||||
|
"extérieures reçoivent des arguments basés sur ce nouvel état."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:385
|
#: ../Doc/library/contextlib.rst:385
|
||||||
msgid ""
|
msgid ""
|
||||||
|
@ -328,6 +460,10 @@ msgid ""
|
||||||
"foundation for higher level context managers that manipulate the exit stack "
|
"foundation for higher level context managers that manipulate the exit stack "
|
||||||
"in application specific ways."
|
"in application specific ways."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"C'est une *API* relativement bas-niveau qui s'occupe de dérouler "
|
||||||
|
"correctement la pile des appels de sortie. Elle fournit une base adaptée "
|
||||||
|
"pour des gestionnaires de contexte de plus haut niveau qui manipulent la "
|
||||||
|
"pile de sortie de manière spécifique à l'application."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:394
|
#: ../Doc/library/contextlib.rst:394
|
||||||
msgid ""
|
msgid ""
|
||||||
|
@ -335,16 +471,24 @@ msgid ""
|
||||||
"callback stack. The return value is the result of the context manager's own :"
|
"callback stack. The return value is the result of the context manager's own :"
|
||||||
"meth:`__enter__` method."
|
"meth:`__enter__` method."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Entre dans un nouveau gestionnaire de contexte et ajoute sa méthode :meth:"
|
||||||
|
"`__exit__` à la pile d'appels. La valeur de retour est le résultat de la "
|
||||||
|
"méthode :meth:`__enter__` du gestionnaire de contexte donné."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:398
|
#: ../Doc/library/contextlib.rst:398
|
||||||
msgid ""
|
msgid ""
|
||||||
"These context managers may suppress exceptions just as they normally would "
|
"These context managers may suppress exceptions just as they normally would "
|
||||||
"if used directly as part of a :keyword:`with` statement."
|
"if used directly as part of a :keyword:`with` statement."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Ces gestionnaires de contexte peuvent supprimer des exceptions comme ils le "
|
||||||
|
"feraient normalement s'ils étaient utilisés directement derrière une "
|
||||||
|
"instruction :keyword:`with`."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:403
|
#: ../Doc/library/contextlib.rst:403
|
||||||
msgid "Adds a context manager's :meth:`__exit__` method to the callback stack."
|
msgid "Adds a context manager's :meth:`__exit__` method to the callback stack."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Ajoute la méthode :meth:`__exit__` d'un gestionnaire de contexte à la pile "
|
||||||
|
"d'appels."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:405
|
#: ../Doc/library/contextlib.rst:405
|
||||||
msgid ""
|
msgid ""
|
||||||
|
@ -352,6 +496,9 @@ msgid ""
|
||||||
"an :meth:`__enter__` implementation with a context manager's own :meth:"
|
"an :meth:`__enter__` implementation with a context manager's own :meth:"
|
||||||
"`__exit__` method."
|
"`__exit__` method."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Comme ``__enter__`` n'est *pas* invoquée, cette méthode peut être utilisée "
|
||||||
|
"pour couvrir une partie de l'implémentation de :meth:`__enter__` avec la "
|
||||||
|
"propre méthode :meth:`__exit__` d'un gestionnaire de contexte."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:409
|
#: ../Doc/library/contextlib.rst:409
|
||||||
msgid ""
|
msgid ""
|
||||||
|
@ -359,36 +506,52 @@ msgid ""
|
||||||
"a callback with the same signature as a context manager's :meth:`__exit__` "
|
"a callback with the same signature as a context manager's :meth:`__exit__` "
|
||||||
"method and adds it directly to the callback stack."
|
"method and adds it directly to the callback stack."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Si l'argument passé n'est pas un gestionnaire de contexte, la méthode assume "
|
||||||
|
"qu'il s'agit d'une fonction de rappel avec la même signature que la méthode :"
|
||||||
|
"meth:`__exit__` des gestionnaires de contexte pour l'ajouter directement à "
|
||||||
|
"la pile d'appels."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:413
|
#: ../Doc/library/contextlib.rst:413
|
||||||
msgid ""
|
msgid ""
|
||||||
"By returning true values, these callbacks can suppress exceptions the same "
|
"By returning true values, these callbacks can suppress exceptions the same "
|
||||||
"way context manager :meth:`__exit__` methods can."
|
"way context manager :meth:`__exit__` methods can."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"En retournant des valeurs vraies, ces fonctions peuvent supprimer des "
|
||||||
|
"exceptions de la même manière que le peuvent les méthodes :meth:`__exit__` "
|
||||||
|
"des gestionnaires de contexte."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:416
|
#: ../Doc/library/contextlib.rst:416
|
||||||
msgid ""
|
msgid ""
|
||||||
"The passed in object is returned from the function, allowing this method to "
|
"The passed in object is returned from the function, allowing this method to "
|
||||||
"be used as a function decorator."
|
"be used as a function decorator."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"L'objet passé en paramètre est renvoyé par la fonction, ce qui permet à la "
|
||||||
|
"méthode d'être utilisée comme décorateur de fonction."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:421
|
#: ../Doc/library/contextlib.rst:421
|
||||||
msgid ""
|
msgid ""
|
||||||
"Accepts an arbitrary callback function and arguments and adds it to the "
|
"Accepts an arbitrary callback function and arguments and adds it to the "
|
||||||
"callback stack."
|
"callback stack."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Accepte une fonction arbitraire et ses arguments et les ajoute à la pile des "
|
||||||
|
"fonctions de rappel."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:424
|
#: ../Doc/library/contextlib.rst:424
|
||||||
msgid ""
|
msgid ""
|
||||||
"Unlike the other methods, callbacks added this way cannot suppress "
|
"Unlike the other methods, callbacks added this way cannot suppress "
|
||||||
"exceptions (as they are never passed the exception details)."
|
"exceptions (as they are never passed the exception details)."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"À la différence des autres méthodes, les fonctions de rappel ajoutées de "
|
||||||
|
"cette manière ne peuvent pas supprimer les exceptions (puisqu'elles ne "
|
||||||
|
"reçoivent jamais les détails de l'exception)."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:427
|
#: ../Doc/library/contextlib.rst:427
|
||||||
msgid ""
|
msgid ""
|
||||||
"The passed in callback is returned from the function, allowing this method "
|
"The passed in callback is returned from the function, allowing this method "
|
||||||
"to be used as a function decorator."
|
"to be used as a function decorator."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"La fonction passée en paramètre est renvoyée par la méthode, ce qui permet à "
|
||||||
|
"la méthode d'être utilisée comme décorateur de fonction."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:432
|
#: ../Doc/library/contextlib.rst:432
|
||||||
msgid ""
|
msgid ""
|
||||||
|
@ -397,12 +560,18 @@ msgid ""
|
||||||
"now be invoked when the new stack is closed (either explicitly or implicitly "
|
"now be invoked when the new stack is closed (either explicitly or implicitly "
|
||||||
"at the end of a :keyword:`with` statement)."
|
"at the end of a :keyword:`with` statement)."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Transfère la pile d'appels à une nouvelle instance de :class:`ExitStack` et "
|
||||||
|
"la renvoie. Aucune fonction de rappel n'est invoquée par cette opération — à "
|
||||||
|
"la place, elles sont dorénavant invoquées quand la nouvelle pile sera close "
|
||||||
|
"(soit explicitement soit implicitement à la fin d'un bloc :keyword:`with`)."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:437
|
#: ../Doc/library/contextlib.rst:437
|
||||||
msgid ""
|
msgid ""
|
||||||
"For example, a group of files can be opened as an \"all or nothing\" "
|
"For example, a group of files can be opened as an \"all or nothing\" "
|
||||||
"operation as follows::"
|
"operation as follows::"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Par exemple, un groupe de fichiers peut être ouvert comme une opération "
|
||||||
|
"« tout ou rien » comme suit ::"
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:451
|
#: ../Doc/library/contextlib.rst:451
|
||||||
msgid ""
|
msgid ""
|
||||||
|
@ -410,6 +579,10 @@ msgid ""
|
||||||
"order of registration. For any context managers and exit callbacks "
|
"order of registration. For any context managers and exit callbacks "
|
||||||
"registered, the arguments passed in will indicate that no exception occurred."
|
"registered, the arguments passed in will indicate that no exception occurred."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Déroule immédiatement la pile d'appels, invoquant les fonctions de rappel "
|
||||||
|
"dans l'ordre inverse d'enregistrement. Pour chaque gestionnaire de contexte "
|
||||||
|
"et fonction de sortie enregistré, les arguments passés indiqueront qu'aucune "
|
||||||
|
"exception n'est survenue."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:458
|
#: ../Doc/library/contextlib.rst:458
|
||||||
msgid ""
|
msgid ""
|
||||||
|
@ -417,49 +590,62 @@ msgid ""
|
||||||
"class:`ExitStack`, that supports combining both synchronous and asynchronous "
|
"class:`ExitStack`, that supports combining both synchronous and asynchronous "
|
||||||
"context managers, as well as having coroutines for cleanup logic."
|
"context managers, as well as having coroutines for cleanup logic."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Un :ref:`gestionnaire de contexte asynchrone <async-context-managers>`, "
|
||||||
|
"similaire à :class:`ExitStack`, apte à combiner à la fois des gestionnaires "
|
||||||
|
"de contexte synchrones et asynchrones, ainsi que la gestion de coroutines "
|
||||||
|
"pour la logique de nettoyage."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:463
|
#: ../Doc/library/contextlib.rst:463
|
||||||
msgid ""
|
msgid ""
|
||||||
"The :meth:`close` method is not implemented, :meth:`aclose` must be used "
|
"The :meth:`close` method is not implemented, :meth:`aclose` must be used "
|
||||||
"instead."
|
"instead."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"La méthode :meth:`close` n'est pas implémentée, :meth:`aclose` doit plutôt "
|
||||||
|
"être utilisée."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:468
|
#: ../Doc/library/contextlib.rst:468
|
||||||
msgid ""
|
msgid ""
|
||||||
"Similar to :meth:`enter_context` but expects an asynchronous context manager."
|
"Similar to :meth:`enter_context` but expects an asynchronous context manager."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Similaire à :meth:`enter_context` mais attend un gestionnaire de contexte "
|
||||||
|
"asynchrone."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:473
|
#: ../Doc/library/contextlib.rst:473
|
||||||
msgid ""
|
msgid ""
|
||||||
"Similar to :meth:`push` but expects either an asynchronous context manager "
|
"Similar to :meth:`push` but expects either an asynchronous context manager "
|
||||||
"or a coroutine function."
|
"or a coroutine function."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Similaire à :meth:`push` mais attend soit un gestionnaire de contexte "
|
||||||
|
"asynchrone soit une fonction coroutine."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:478
|
#: ../Doc/library/contextlib.rst:478
|
||||||
msgid "Similar to :meth:`callback` but expects a coroutine function."
|
msgid "Similar to :meth:`callback` but expects a coroutine function."
|
||||||
msgstr ""
|
msgstr "Similaire à :meth:`callback` mais attend une fonction coroutine."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:482
|
#: ../Doc/library/contextlib.rst:482
|
||||||
msgid "Similar to :meth:`close` but properly handles awaitables."
|
msgid "Similar to :meth:`close` but properly handles awaitables."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Similaire à :meth:`close` mais gère correctement les tâches asynchrones."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:484
|
#: ../Doc/library/contextlib.rst:484
|
||||||
msgid "Continuing the example for :func:`asynccontextmanager`::"
|
msgid "Continuing the example for :func:`asynccontextmanager`::"
|
||||||
msgstr ""
|
msgstr "En continuité de l'exemple de :func:`asynccontextmanager` ::"
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:496
|
#: ../Doc/library/contextlib.rst:496
|
||||||
msgid "Examples and Recipes"
|
msgid "Examples and Recipes"
|
||||||
msgstr ""
|
msgstr "Exemples et Recettes"
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:498
|
#: ../Doc/library/contextlib.rst:498
|
||||||
msgid ""
|
msgid ""
|
||||||
"This section describes some examples and recipes for making effective use of "
|
"This section describes some examples and recipes for making effective use of "
|
||||||
"the tools provided by :mod:`contextlib`."
|
"the tools provided by :mod:`contextlib`."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Cette section décrit quelques exemples et recettes pour décrire une "
|
||||||
|
"utilisation réelle des outils fournis par :mod:`contextlib`."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:503
|
#: ../Doc/library/contextlib.rst:503
|
||||||
msgid "Supporting a variable number of context managers"
|
msgid "Supporting a variable number of context managers"
|
||||||
msgstr ""
|
msgstr "Gérer un nombre variable de gestionnaires de contexte"
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:505
|
#: ../Doc/library/contextlib.rst:505
|
||||||
msgid ""
|
msgid ""
|
||||||
|
@ -470,6 +656,13 @@ msgid ""
|
||||||
"input (such as opening a user specified collection of files), or from some "
|
"input (such as opening a user specified collection of files), or from some "
|
||||||
"of the context managers being optional::"
|
"of the context managers being optional::"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Le cas d'utilisation primaire de :class:`ExitStack` est celui décrit dans la "
|
||||||
|
"documentation de la classe : gérer un nombre variable de gestionnaires de "
|
||||||
|
"contexte et d'autres opérations de nettoyage en une unique instruction :"
|
||||||
|
"keyword:`with`. La variabilité peut venir du nombre de gestionnaires de "
|
||||||
|
"contexte voulus découlant d'une entrée de l'utilisateur (comme ouvrir une "
|
||||||
|
"collection spécifique de fichiers de l'utilisateur), ou de certains "
|
||||||
|
"gestionnaires de contexte qui peuvent être optionnels ::"
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:520
|
#: ../Doc/library/contextlib.rst:520
|
||||||
msgid ""
|
msgid ""
|
||||||
|
@ -477,10 +670,13 @@ msgid ""
|
||||||
"statements to manage arbitrary resources that don't natively support the "
|
"statements to manage arbitrary resources that don't natively support the "
|
||||||
"context management protocol."
|
"context management protocol."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Comme montré, :class:`ExitStack` rend aussi assez facile d'utiliser les "
|
||||||
|
"instructions :keyword:`with` pour gérer des ressources arbitraires qui ne "
|
||||||
|
"gèrent pas nativement le protocole des gestionnaires de contexte."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:526
|
#: ../Doc/library/contextlib.rst:526
|
||||||
msgid "Catching exceptions from ``__enter__`` methods"
|
msgid "Catching exceptions from ``__enter__`` methods"
|
||||||
msgstr ""
|
msgstr "Attraper des exceptions depuis les méthodes ``__enter__``"
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:528
|
#: ../Doc/library/contextlib.rst:528
|
||||||
msgid ""
|
msgid ""
|
||||||
|
@ -490,6 +686,12 @@ msgid ""
|
||||||
"By using :class:`ExitStack` the steps in the context management protocol can "
|
"By using :class:`ExitStack` the steps in the context management protocol can "
|
||||||
"be separated slightly in order to allow this::"
|
"be separated slightly in order to allow this::"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Il est occasionnellement souhaitable d'attraper les exceptions depuis "
|
||||||
|
"l'implémentation d'une méthode ``__enter__``, *sans* attraper par "
|
||||||
|
"inadvertance les exceptions du corps de l'instruction :keyword:`with` ou de "
|
||||||
|
"la méthode ``__exit__`` des gestionnaires de contexte. En utilisant :class:"
|
||||||
|
"`ExitStack`, les étapes du protocole des gestionnaires de contexte peuvent "
|
||||||
|
"être légèrement séparées pour permettre le code suivant ::"
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:543
|
#: ../Doc/library/contextlib.rst:543
|
||||||
msgid ""
|
msgid ""
|
||||||
|
@ -501,10 +703,18 @@ msgid ""
|
||||||
"to handle various situations that can't be handled directly in a :keyword:"
|
"to handle various situations that can't be handled directly in a :keyword:"
|
||||||
"`with` statement."
|
"`with` statement."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Avoir à faire cela est en fait surtout utile pour indiquer que l'*API* sous-"
|
||||||
|
"jacente devrait fournir une interface directe de gestion des ressources à "
|
||||||
|
"utiliser avec les instructions :keyword:`try`/:keyword:`except`/:keyword:"
|
||||||
|
"`finally`, mais que toutes les *API* ne sont pas bien conçues dans cet "
|
||||||
|
"objectif. Quand un gestionnaire de contexte est la seule *API* de gestion "
|
||||||
|
"des ressources fournie, alors :class:`ExitStack` peut rendre plus facile la "
|
||||||
|
"gestion de plusieurs situations qui ne peuvent pas être traitées directement "
|
||||||
|
"dans une instruction :keyword:`with`."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:553
|
#: ../Doc/library/contextlib.rst:553
|
||||||
msgid "Cleaning up in an ``__enter__`` implementation"
|
msgid "Cleaning up in an ``__enter__`` implementation"
|
||||||
msgstr ""
|
msgstr "Nettoyer dans une méthode ``__enter__``"
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:555
|
#: ../Doc/library/contextlib.rst:555
|
||||||
msgid ""
|
msgid ""
|
||||||
|
@ -512,6 +722,9 @@ msgid ""
|
||||||
"useful in cleaning up an already allocated resource if later steps in the :"
|
"useful in cleaning up an already allocated resource if later steps in the :"
|
||||||
"meth:`__enter__` implementation fail."
|
"meth:`__enter__` implementation fail."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Comme indiqué dans la documentation de :meth:`ExitStack.push`, cette méthode "
|
||||||
|
"peut être utile pour nettoyer une ressource déjà allouée si les dernières "
|
||||||
|
"étapes de l'implémentation de :meth:`__enter__` échouent."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:559
|
#: ../Doc/library/contextlib.rst:559
|
||||||
msgid ""
|
msgid ""
|
||||||
|
@ -519,10 +732,13 @@ msgid ""
|
||||||
"acquisition and release functions, along with an optional validation "
|
"acquisition and release functions, along with an optional validation "
|
||||||
"function, and maps them to the context management protocol::"
|
"function, and maps them to the context management protocol::"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Voici un exemple de gestionnaire de contexte qui reçoit des fonctions "
|
||||||
|
"d'acquisition de ressources et de libération, avec une méthode de validation "
|
||||||
|
"optionnelle, et qui les adapte au protocole des gestionnaires de contexte ::"
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:599
|
#: ../Doc/library/contextlib.rst:599
|
||||||
msgid "Replacing any use of ``try-finally`` and flag variables"
|
msgid "Replacing any use of ``try-finally`` and flag variables"
|
||||||
msgstr ""
|
msgstr "Remplacer un ``try-finally`` avec une option variable"
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:601
|
#: ../Doc/library/contextlib.rst:601
|
||||||
msgid ""
|
msgid ""
|
||||||
|
@ -531,6 +747,10 @@ msgid ""
|
||||||
"should be executed. In its simplest form (that can't already be handled just "
|
"should be executed. In its simplest form (that can't already be handled just "
|
||||||
"by using an ``except`` clause instead), it looks something like this::"
|
"by using an ``except`` clause instead), it looks something like this::"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Un modèle que vous rencontrerez parfois est un bloc ``try-finally`` avec une "
|
||||||
|
"option pour indiquer si le corps de la clause ``finally`` doit être exécuté "
|
||||||
|
"ou non. Dans sa forme la plus simple (qui ne peut pas déjà être gérée avec "
|
||||||
|
"juste une clause ``except``), cela ressemble à ::"
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:615
|
#: ../Doc/library/contextlib.rst:615
|
||||||
msgid ""
|
msgid ""
|
||||||
|
@ -538,6 +758,10 @@ msgid ""
|
||||||
"development and review, because the setup code and the cleanup code can end "
|
"development and review, because the setup code and the cleanup code can end "
|
||||||
"up being separated by arbitrarily long sections of code."
|
"up being separated by arbitrarily long sections of code."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Comme avec n'importe quel code basé sur une instruction ``try``, cela peut "
|
||||||
|
"poser problème pour le développement et la revue, parce que beaucoup de "
|
||||||
|
"codes d'installation et de nettoyage peuvent finir par être séparés par des "
|
||||||
|
"sections de code arbitrairement longues."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:619
|
#: ../Doc/library/contextlib.rst:619
|
||||||
msgid ""
|
msgid ""
|
||||||
|
@ -545,18 +769,25 @@ msgid ""
|
||||||
"execution at the end of a ``with`` statement, and then later decide to skip "
|
"execution at the end of a ``with`` statement, and then later decide to skip "
|
||||||
"executing that callback::"
|
"executing that callback::"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
":class:`ExitStack` rend possible de plutôt enregistrer une fonction de "
|
||||||
|
"rappel pour être exécutée à la fin d'une instruction ``with``, et décider "
|
||||||
|
"ensuite de passer l'exécution de cet appel ::"
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:631
|
#: ../Doc/library/contextlib.rst:631
|
||||||
msgid ""
|
msgid ""
|
||||||
"This allows the intended cleanup up behaviour to be made explicit up front, "
|
"This allows the intended cleanup up behaviour to be made explicit up front, "
|
||||||
"rather than requiring a separate flag variable."
|
"rather than requiring a separate flag variable."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Cela permet de rendre explicite dès le départ le comportement de nettoyage "
|
||||||
|
"attendu, plutôt que de nécessiter une option séparée."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:634
|
#: ../Doc/library/contextlib.rst:634
|
||||||
msgid ""
|
msgid ""
|
||||||
"If a particular application uses this pattern a lot, it can be simplified "
|
"If a particular application uses this pattern a lot, it can be simplified "
|
||||||
"even further by means of a small helper class::"
|
"even further by means of a small helper class::"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Si une application particulière utilise beaucoup ce modèle, cela peut-être "
|
||||||
|
"simplifié encore plus au moyen d'une petite classe d'aide ::"
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:652
|
#: ../Doc/library/contextlib.rst:652
|
||||||
msgid ""
|
msgid ""
|
||||||
|
@ -564,6 +795,10 @@ msgid ""
|
||||||
"function, then it is still possible to use the decorator form of :meth:"
|
"function, then it is still possible to use the decorator form of :meth:"
|
||||||
"`ExitStack.callback` to declare the resource cleanup in advance::"
|
"`ExitStack.callback` to declare the resource cleanup in advance::"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Si le nettoyage de la ressource n'est pas déjà soigneusement embarqué dans "
|
||||||
|
"une fonction autonome, il est possible d'utiliser le décorateur :meth:"
|
||||||
|
"`ExitStack.callback` pour déclarer la fonction de nettoyage de ressource en "
|
||||||
|
"avance ::"
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:667
|
#: ../Doc/library/contextlib.rst:667
|
||||||
msgid ""
|
msgid ""
|
||||||
|
@ -571,16 +806,24 @@ msgid ""
|
||||||
"this way cannot take any parameters. Instead, any resources to be released "
|
"this way cannot take any parameters. Instead, any resources to be released "
|
||||||
"must be accessed as closure variables."
|
"must be accessed as closure variables."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Dû au fonctionnement du protocole des décorateurs, une fonction déclarée "
|
||||||
|
"ainsi ne peut prendre aucun paramètre. À la place, les ressources à libérer "
|
||||||
|
"doivent être récupérées depuis l'extérieur comme des variables de fermeture "
|
||||||
|
"(*closure*)."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:673
|
#: ../Doc/library/contextlib.rst:673
|
||||||
msgid "Using a context manager as a function decorator"
|
msgid "Using a context manager as a function decorator"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Utiliser un gestionnaire de contexte en tant que décorateur de fonction"
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:675
|
#: ../Doc/library/contextlib.rst:675
|
||||||
msgid ""
|
msgid ""
|
||||||
":class:`ContextDecorator` makes it possible to use a context manager in both "
|
":class:`ContextDecorator` makes it possible to use a context manager in both "
|
||||||
"an ordinary ``with`` statement and also as a function decorator."
|
"an ordinary ``with`` statement and also as a function decorator."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
":class:`ContextDecorator` rend possible l'utilisation d'un gestionnaire de "
|
||||||
|
"contexte à la fois ordinairement avec une instruction ``with`` ou comme un "
|
||||||
|
"décorateur de fonction."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:678
|
#: ../Doc/library/contextlib.rst:678
|
||||||
msgid ""
|
msgid ""
|
||||||
|
@ -590,14 +833,22 @@ msgid ""
|
||||||
"task, inheriting from :class:`ContextDecorator` provides both capabilities "
|
"task, inheriting from :class:`ContextDecorator` provides both capabilities "
|
||||||
"in a single definition::"
|
"in a single definition::"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Par exemple, il est parfois utile d'emballer les fonctions ou blocs "
|
||||||
|
"d'instructions avec un journaliseur qui pourrait suivre le temps d'exécution "
|
||||||
|
"entre l'entrée et la sortie. Plutôt qu'écrire à la fois un décorateur et un "
|
||||||
|
"gestionnaire de contexte pour la même tâche, hériter de :class:"
|
||||||
|
"`ContextDecorator` fournit les deux fonctionnalités en une seule "
|
||||||
|
"définition ::"
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:699
|
#: ../Doc/library/contextlib.rst:699
|
||||||
msgid "Instances of this class can be used as both a context manager::"
|
msgid "Instances of this class can be used as both a context manager::"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Les instances de cette classe peuvent être utilisées comme gestionnaires de "
|
||||||
|
"contexte ::"
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:705
|
#: ../Doc/library/contextlib.rst:705
|
||||||
msgid "And also as a function decorator::"
|
msgid "And also as a function decorator::"
|
||||||
msgstr ""
|
msgstr "Et comme décorateurs de fonctions ::"
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:712
|
#: ../Doc/library/contextlib.rst:712
|
||||||
msgid ""
|
msgid ""
|
||||||
|
@ -606,6 +857,10 @@ msgid ""
|
||||||
"`__enter__`. If that value is needed, then it is still necessary to use an "
|
"`__enter__`. If that value is needed, then it is still necessary to use an "
|
||||||
"explicit ``with`` statement."
|
"explicit ``with`` statement."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Notez qu'il y a une autre limitation en utilisant les gestionnaires de "
|
||||||
|
"contexte comme décorateurs : il n'y a aucune manière d'accéder à la valeur "
|
||||||
|
"de retour de :meth:`__enter__`. Si cette valeur est nécessaire, il faut "
|
||||||
|
"utiliser explicitement une instruction ``with``."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:720
|
#: ../Doc/library/contextlib.rst:720
|
||||||
msgid ":pep:`343` - The \"with\" statement"
|
msgid ":pep:`343` - The \"with\" statement"
|
||||||
|
@ -621,7 +876,7 @@ msgstr ""
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:726
|
#: ../Doc/library/contextlib.rst:726
|
||||||
msgid "Single use, reusable and reentrant context managers"
|
msgid "Single use, reusable and reentrant context managers"
|
||||||
msgstr ""
|
msgstr "Gestionnaires de contexte à usage unique, réutilisables et réentrants"
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:728
|
#: ../Doc/library/contextlib.rst:728
|
||||||
msgid ""
|
msgid ""
|
||||||
|
@ -630,6 +885,11 @@ msgid ""
|
||||||
"managers must be created afresh each time they're used - attempting to use "
|
"managers must be created afresh each time they're used - attempting to use "
|
||||||
"them a second time will trigger an exception or otherwise not work correctly."
|
"them a second time will trigger an exception or otherwise not work correctly."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"La plupart des gestionnaires de contexte sont écrits d'une manière qui ne "
|
||||||
|
"leur permet que d'être utilisés une fois avec une instruction :keyword:"
|
||||||
|
"`with`. Ces gestionnaires de contexte à usage unique doivent être recréés "
|
||||||
|
"chaque fois qu'ils sont utilisés — tenter de les utiliser une seconde fois "
|
||||||
|
"lève une exception ou ne fonctionne pas correctement."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:734
|
#: ../Doc/library/contextlib.rst:734
|
||||||
msgid ""
|
msgid ""
|
||||||
|
@ -637,6 +897,10 @@ msgid ""
|
||||||
"context managers directly in the header of the :keyword:`with` statement "
|
"context managers directly in the header of the :keyword:`with` statement "
|
||||||
"where they are used (as shown in all of the usage examples above)."
|
"where they are used (as shown in all of the usage examples above)."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Cette limitation commune signifie qu'il est généralement conseillé de créer "
|
||||||
|
"les gestionnaires de contexte directement dans l'en-tête du bloc :keyword:"
|
||||||
|
"`with` où ils sont utilisés (comme montré dans tous les exemples "
|
||||||
|
"d'utilisation au-dessus)."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:738
|
#: ../Doc/library/contextlib.rst:738
|
||||||
msgid ""
|
msgid ""
|
||||||
|
@ -644,6 +908,10 @@ msgid ""
|
||||||
"first :keyword:`with` statement will close the file, preventing any further "
|
"first :keyword:`with` statement will close the file, preventing any further "
|
||||||
"IO operations using that file object."
|
"IO operations using that file object."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Les fichiers sont un exemple de gestionnaires de contexte étant "
|
||||||
|
"effectivement à usage unique, puisque la première instruction :keyword:"
|
||||||
|
"`with` ferme le fichier, empêchant d'autres opérations d'entrée/sortie "
|
||||||
|
"d'être exécutées sur ce fichier."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:742
|
#: ../Doc/library/contextlib.rst:742
|
||||||
msgid ""
|
msgid ""
|
||||||
|
@ -651,10 +919,13 @@ msgid ""
|
||||||
"context managers, and will complain about the underlying generator failing "
|
"context managers, and will complain about the underlying generator failing "
|
||||||
"to yield if an attempt is made to use them a second time::"
|
"to yield if an attempt is made to use them a second time::"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Les gestionnaires de contexte créés avec :func:`contextmanager` sont aussi à "
|
||||||
|
"usage unique, et se plaindront du fait que le générateur sous-jacent ne "
|
||||||
|
"produise plus de valeur si vous essayez de les utiliser une seconde fois ::"
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:770
|
#: ../Doc/library/contextlib.rst:770
|
||||||
msgid "Reentrant context managers"
|
msgid "Reentrant context managers"
|
||||||
msgstr ""
|
msgstr "Gestionnaires de contexte réentrants"
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:772
|
#: ../Doc/library/contextlib.rst:772
|
||||||
msgid ""
|
msgid ""
|
||||||
|
@ -663,6 +934,11 @@ msgid ""
|
||||||
"may also be used *inside* a :keyword:`!with` statement that is already using "
|
"may also be used *inside* a :keyword:`!with` statement that is already using "
|
||||||
"the same context manager."
|
"the same context manager."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Certains gestionnaires de contexte plus sophistiqués peuvent être "
|
||||||
|
"« réentrants ». Ces gestionnaires de contexte ne peuvent pas seulement être "
|
||||||
|
"utilisés avec plusieurs instructions :keyword:`with`, mais aussi *à "
|
||||||
|
"l'intérieur* d'une instruction :keyword:`!with` qui utilise déjà ce même "
|
||||||
|
"gestionnaire de contexte."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:777
|
#: ../Doc/library/contextlib.rst:777
|
||||||
msgid ""
|
msgid ""
|
||||||
|
@ -670,6 +946,9 @@ msgid ""
|
||||||
"are :func:`suppress` and :func:`redirect_stdout`. Here's a very simple "
|
"are :func:`suppress` and :func:`redirect_stdout`. Here's a very simple "
|
||||||
"example of reentrant use::"
|
"example of reentrant use::"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
":class:`threading.RLock` est un exemple de gestionnaire de contexte "
|
||||||
|
"réentrant, comme le sont aussi :func:`suppress` et :func:`redirect_stdout`. "
|
||||||
|
"Voici un très simple exemple d'utilisation réentrante ::"
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:796
|
#: ../Doc/library/contextlib.rst:796
|
||||||
msgid ""
|
msgid ""
|
||||||
|
@ -677,6 +956,9 @@ msgid ""
|
||||||
"functions calling each other and hence be far more complicated than this "
|
"functions calling each other and hence be far more complicated than this "
|
||||||
"example."
|
"example."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Les exemples plus réels de réentrance sont susceptibles d'invoquer plusieurs "
|
||||||
|
"fonctions s'entre-appelant, et donc être bien plus compliqués que cet "
|
||||||
|
"exemple."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:800
|
#: ../Doc/library/contextlib.rst:800
|
||||||
msgid ""
|
msgid ""
|
||||||
|
@ -685,10 +967,14 @@ msgid ""
|
||||||
"as it makes a global modification to the system state by binding :data:`sys."
|
"as it makes a global modification to the system state by binding :data:`sys."
|
||||||
"stdout` to a different stream."
|
"stdout` to a different stream."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Notez aussi qu'être réentrant ne signifie *pas* être *thread safe*. :func:"
|
||||||
|
"`redirect_stdout`, par exemple, n'est définitivement pas *thread safe*, "
|
||||||
|
"puisqu'il effectue des changements globaux sur l'état du système en "
|
||||||
|
"branchant :data:`sys.stdout` sur différents flux."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:809
|
#: ../Doc/library/contextlib.rst:809
|
||||||
msgid "Reusable context managers"
|
msgid "Reusable context managers"
|
||||||
msgstr ""
|
msgstr "Gestionnaires de contexte réutilisables"
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:811
|
#: ../Doc/library/contextlib.rst:811
|
||||||
msgid ""
|
msgid ""
|
||||||
|
@ -699,6 +985,14 @@ msgid ""
|
||||||
"will fail (or otherwise not work correctly) if the specific context manager "
|
"will fail (or otherwise not work correctly) if the specific context manager "
|
||||||
"instance has already been used in a containing with statement."
|
"instance has already been used in a containing with statement."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"D'autres gestionnaires de contexte que ceux à usage unique et les réentrants "
|
||||||
|
"sont les gestionnaires de contexte « réutilisables » (ou, pour être plus "
|
||||||
|
"explicite, « réutilisables mais pas réentrants », puisque les gestionnaires "
|
||||||
|
"de contexte réentrants sont aussi réutilisables). Ces gestionnaires de "
|
||||||
|
"contexte sont conçus afin d'être utilisés plusieurs fois, mais échoueront "
|
||||||
|
"(ou ne fonctionnent pas correctement) si l'instance de gestionnaire de "
|
||||||
|
"contexte référencée a déjà été utilisée dans une instruction *with* "
|
||||||
|
"englobante."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:818
|
#: ../Doc/library/contextlib.rst:818
|
||||||
msgid ""
|
msgid ""
|
||||||
|
@ -706,6 +1000,9 @@ msgid ""
|
||||||
"context manager (for a reentrant lock, it is necessary to use :class:"
|
"context manager (for a reentrant lock, it is necessary to use :class:"
|
||||||
"`threading.RLock` instead)."
|
"`threading.RLock` instead)."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
":class:`threading.Lock` est un exemple de gestionnaire de contexte "
|
||||||
|
"réutilisable mais pas réentrant (pour un verrou réentrant, il faut à la "
|
||||||
|
"place utiliser :class:`threading.RLock`)."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:822
|
#: ../Doc/library/contextlib.rst:822
|
||||||
msgid ""
|
msgid ""
|
||||||
|
@ -713,6 +1010,10 @@ msgid ""
|
||||||
"`ExitStack`, as it invokes *all* currently registered callbacks when leaving "
|
"`ExitStack`, as it invokes *all* currently registered callbacks when leaving "
|
||||||
"any with statement, regardless of where those callbacks were added::"
|
"any with statement, regardless of where those callbacks were added::"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Un autre exemple de gestionnaire de contexte réutilisable mais pas réentrant "
|
||||||
|
"est :class:`ExitStack`, puisqu'il invoque *toutes* les fonctions de rappel "
|
||||||
|
"actuellement enregistrées en quittant l'instruction *with*, sans regarder où "
|
||||||
|
"ces fonctions ont été ajoutées ::"
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:853
|
#: ../Doc/library/contextlib.rst:853
|
||||||
msgid ""
|
msgid ""
|
||||||
|
@ -721,9 +1022,15 @@ msgid ""
|
||||||
"cause the stack to be cleared at the end of the innermost with statement, "
|
"cause the stack to be cleared at the end of the innermost with statement, "
|
||||||
"which is unlikely to be desirable behaviour."
|
"which is unlikely to be desirable behaviour."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Comme le montre la sortie de l'exemple, réutiliser une simple pile entre "
|
||||||
|
"plusieurs instructions *with* fonctionne correctement, mais essayer de les "
|
||||||
|
"imbriquer fait que la pile est vidée à la fin du *with* le plus imbriqué, ce "
|
||||||
|
"qui n'est probablement pas le comportement voulu."
|
||||||
|
|
||||||
#: ../Doc/library/contextlib.rst:858
|
#: ../Doc/library/contextlib.rst:858
|
||||||
msgid ""
|
msgid ""
|
||||||
"Using separate :class:`ExitStack` instances instead of reusing a single "
|
"Using separate :class:`ExitStack` instances instead of reusing a single "
|
||||||
"instance avoids that problem::"
|
"instance avoids that problem::"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Pour éviter ce problème, utilisez des instances différentes de :class:"
|
||||||
|
"`ExitStack` plutôt qu'une seule instance ::"
|
||||||
|
|
Loading…
Reference in New Issue