1
0
Fork 0
python-docs-fr/library/contextvars.po

256 lines
7.4 KiB
Plaintext
Raw Normal View History

2018-06-28 13:32:56 +00:00
# Copyright (C) 2001-2018, Python Software Foundation
2018-07-04 09:08:42 +00:00
# For licence information, see README file.
2018-06-28 13:32:56 +00:00
#
msgid ""
msgstr ""
2019-12-05 22:15:54 +00:00
"Project-Id-Version: Python 3\n"
2018-06-28 13:32:56 +00:00
"Report-Msgid-Bugs-To: \n"
2020-09-11 07:11:46 +00:00
"POT-Creation-Date: 2020-08-24 09:01+0200\n"
"PO-Revision-Date: 2018-08-03 23:47+0200\n"
"Last-Translator: Julien Palard <julien@palard.fr>\n"
2018-07-04 09:14:25 +00:00
"Language-Team: FRENCH <traductions@lists.afpy.org>\n"
"Language: fr\n"
2018-06-28 13:32:56 +00:00
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: library/contextvars.rst:2
2018-06-28 13:32:56 +00:00
msgid ":mod:`contextvars` --- Context Variables"
msgstr ""
#: library/contextvars.rst:11
2018-06-28 13:32:56 +00:00
msgid ""
"This module provides APIs to manage, store, and access context-local state. "
"The :class:`~contextvars.ContextVar` class is used to declare and work with "
"*Context Variables*. The :func:`~contextvars.copy_context` function and "
"the :class:`~contextvars.Context` class should be used to manage the current "
"context in asynchronous frameworks."
msgstr ""
#: library/contextvars.rst:17
2018-06-28 13:32:56 +00:00
msgid ""
"Context managers that have state should use Context Variables instead of :"
"func:`threading.local()` to prevent their state from bleeding to other code "
"unexpectedly, when used in concurrent code."
msgstr ""
#: library/contextvars.rst:21
2018-06-28 13:32:56 +00:00
msgid "See also :pep:`567` for additional details."
msgstr ""
#: library/contextvars.rst:27
2018-06-28 13:32:56 +00:00
msgid "Context Variables"
msgstr ""
#: library/contextvars.rst:31
2018-06-28 13:32:56 +00:00
msgid "This class is used to declare a new Context Variable, e.g.::"
msgstr ""
#: library/contextvars.rst:35
2018-06-28 13:32:56 +00:00
msgid ""
"The required *name* parameter is used for introspection and debug purposes."
msgstr ""
#: library/contextvars.rst:38
2018-06-28 13:32:56 +00:00
msgid ""
"The optional keyword-only *default* parameter is returned by :meth:"
"`ContextVar.get` when no value for the variable is found in the current "
"context."
msgstr ""
#: library/contextvars.rst:42
2018-06-28 13:32:56 +00:00
msgid ""
"**Important:** Context Variables should be created at the top module level "
"and never in closures. :class:`Context` objects hold strong references to "
"context variables which prevents context variables from being properly "
"garbage collected."
msgstr ""
#: library/contextvars.rst:49
2018-06-28 13:32:56 +00:00
msgid "The name of the variable. This is a read-only property."
msgstr ""
#: library/contextvars.rst:55
2018-06-28 13:32:56 +00:00
msgid "Return a value for the context variable for the current context."
msgstr ""
#: library/contextvars.rst:57
2018-06-28 13:32:56 +00:00
msgid ""
"If there is no value for the variable in the current context, the method "
"will:"
msgstr ""
#: library/contextvars.rst:60
2018-06-28 13:32:56 +00:00
msgid ""
"return the value of the *default* argument of the method, if provided; or"
msgstr ""
#: library/contextvars.rst:63
2018-06-28 13:32:56 +00:00
msgid ""
"return the default value for the context variable, if it was created with "
"one; or"
msgstr ""
#: library/contextvars.rst:66
2018-06-28 13:32:56 +00:00
msgid "raise a :exc:`LookupError`."
msgstr ""
#: library/contextvars.rst:70
2018-06-28 13:32:56 +00:00
msgid ""
"Call to set a new value for the context variable in the current context."
msgstr ""
#: library/contextvars.rst:73
2018-06-28 13:32:56 +00:00
msgid ""
"The required *value* argument is the new value for the context variable."
msgstr ""
#: library/contextvars.rst:76
2018-06-28 13:32:56 +00:00
msgid ""
"Returns a :class:`~contextvars.Token` object that can be used to restore the "
"variable to its previous value via the :meth:`ContextVar.reset` method."
msgstr ""
#: library/contextvars.rst:82
2018-06-28 13:32:56 +00:00
msgid ""
"Reset the context variable to the value it had before the :meth:`ContextVar."
"set` that created the *token* was used."
msgstr ""
#: library/contextvars.rst:85
2018-06-28 13:32:56 +00:00
msgid "For example::"
msgstr "Par exemple ::"
2018-06-28 13:32:56 +00:00
#: library/contextvars.rst:99
2018-06-28 13:32:56 +00:00
msgid ""
"*Token* objects are returned by the :meth:`ContextVar.set` method. They can "
"be passed to the :meth:`ContextVar.reset` method to revert the value of the "
"variable to what it was before the corresponding *set*."
msgstr ""
#: library/contextvars.rst:106
2018-06-28 13:32:56 +00:00
msgid ""
"A read-only property. Points to the :class:`ContextVar` object that created "
"the token."
msgstr ""
#: library/contextvars.rst:111
2018-06-28 13:32:56 +00:00
msgid ""
"A read-only property. Set to the value the variable had before the :meth:"
"`ContextVar.set` method call that created the token. It points to :attr:"
"`Token.MISSING` is the variable was not set before the call."
msgstr ""
#: library/contextvars.rst:118
2018-06-28 13:32:56 +00:00
msgid "A marker object used by :attr:`Token.old_value`."
msgstr ""
#: library/contextvars.rst:122
2018-06-28 13:32:56 +00:00
msgid "Manual Context Management"
msgstr ""
#: library/contextvars.rst:126
2018-06-28 13:32:56 +00:00
msgid "Returns a copy of the current :class:`~contextvars.Context` object."
msgstr ""
#: library/contextvars.rst:128
2018-06-28 13:32:56 +00:00
msgid ""
"The following snippet gets a copy of the current context and prints all "
"variables and their values that are set in it::"
msgstr ""
#: library/contextvars.rst:134
2018-06-28 13:32:56 +00:00
msgid ""
"The function has an O(1) complexity, i.e. works equally fast for contexts "
"with a few context variables and for contexts that have a lot of them."
msgstr ""
#: library/contextvars.rst:141
2018-06-28 13:32:56 +00:00
msgid "A mapping of :class:`ContextVars <ContextVar>` to their values."
msgstr ""
#: library/contextvars.rst:143
2018-06-28 13:32:56 +00:00
msgid ""
"``Context()`` creates an empty context with no values in it. To get a copy "
"of the current context use the :func:`~contextvars.copy_context` function."
msgstr ""
#: library/contextvars.rst:147
2018-06-28 13:32:56 +00:00
msgid "Context implements the :class:`collections.abc.Mapping` interface."
msgstr ""
#: library/contextvars.rst:151
2018-06-28 13:32:56 +00:00
msgid ""
"Execute ``callable(*args, **kwargs)`` code in the context object the *run* "
"method is called on. Return the result of the execution or propagate an "
"exception if one occurred."
msgstr ""
#: library/contextvars.rst:155
2018-06-28 13:32:56 +00:00
msgid ""
"Any changes to any context variables that *callable* makes will be contained "
"in the context object::"
msgstr ""
#: library/contextvars.rst:184
2018-06-28 13:32:56 +00:00
msgid ""
"The method raises a :exc:`RuntimeError` when called on the same context "
"object from more than one OS thread, or when called recursively."
msgstr ""
#: library/contextvars.rst:190
2018-06-28 13:32:56 +00:00
msgid "Return a shallow copy of the context object."
msgstr ""
#: library/contextvars.rst:194
2018-06-28 13:32:56 +00:00
msgid ""
"Return ``True`` if the *context* has a value for *var* set; return ``False`` "
"otherwise."
msgstr ""
#: library/contextvars.rst:199
2018-06-28 13:32:56 +00:00
msgid ""
"Return the value of the *var* :class:`ContextVar` variable. If the variable "
"is not set in the context object, a :exc:`KeyError` is raised."
msgstr ""
#: library/contextvars.rst:205
2018-06-28 13:32:56 +00:00
msgid ""
"Return the value for *var* if *var* has the value in the context object. "
"Return *default* otherwise. If *default* is not given, return ``None``."
msgstr ""
#: library/contextvars.rst:211
2018-06-28 13:32:56 +00:00
msgid "Return an iterator over the variables stored in the context object."
msgstr ""
#: library/contextvars.rst:216
2018-06-28 13:32:56 +00:00
msgid "Return the number of variables set in the context object."
msgstr ""
#: library/contextvars.rst:220
2018-06-28 13:32:56 +00:00
msgid "Return a list of all variables in the context object."
msgstr ""
#: library/contextvars.rst:224
2018-06-28 13:32:56 +00:00
msgid "Return a list of all variables' values in the context object."
msgstr ""
#: library/contextvars.rst:229
2018-06-28 13:32:56 +00:00
msgid ""
"Return a list of 2-tuples containing all variables and their values in the "
"context object."
msgstr ""
#: library/contextvars.rst:234
2018-06-28 13:32:56 +00:00
msgid "asyncio support"
msgstr ""
#: library/contextvars.rst:236
2018-06-28 13:32:56 +00:00
msgid ""
"Context variables are natively supported in :mod:`asyncio` and are ready to "
"be used without any extra configuration. For example, here is a simple echo "
"server, that uses a context variable to make the address of a remote client "
"available in the Task that handles that client::"
msgstr ""