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 ""
|
2019-12-05 22:15:54 +00:00
|
|
|
|
"Project-Id-Version: Python 3\n"
|
2016-10-30 09:46:26 +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"
|
2020-05-03 15:12:15 +00:00
|
|
|
|
"PO-Revision-Date: 2019-11-26 17:28-0500\n"
|
2020-05-24 14:31:50 +00:00
|
|
|
|
"Last-Translator: \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"
|
2020-05-03 15:12:15 +00:00
|
|
|
|
"X-Generator: Poedit 2.2.4\n"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:3
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ":mod:`typing` --- Support for type hints"
|
2020-05-03 15:12:15 +00:00
|
|
|
|
msgstr ":mod:`typing` — Prise en charge des annotations de type"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:10
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "**Source code:** :source:`Lib/typing.py`"
|
|
|
|
|
msgstr "**Code source :** :source:`Lib/typing.py`"
|
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:14
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
2019-10-09 16:10:12 +00:00
|
|
|
|
"The Python runtime does not enforce function and variable type annotations. "
|
|
|
|
|
"They can be used by third party tools such as type checkers, IDEs, linters, "
|
|
|
|
|
"etc."
|
2017-04-02 20:14:06 +00:00
|
|
|
|
msgstr ""
|
2020-05-03 15:12:15 +00:00
|
|
|
|
"Le moteur d'exécution Python n'applique pas les annotations de type pour les "
|
|
|
|
|
"fonctions et les variables. Elles peuvent être utilisées par des outils "
|
|
|
|
|
"tiers tels que les contrôleurs de type, les IDE, les analyseurs de code, etc."
|
2017-04-02 20:14:06 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:20
|
2017-04-02 20:14:06 +00:00
|
|
|
|
msgid ""
|
2019-09-04 09:35:23 +00:00
|
|
|
|
"This module provides runtime support for type hints as specified by :pep:"
|
|
|
|
|
"`484`, :pep:`526`, :pep:`544`, :pep:`586`, :pep:`589`, and :pep:`591`. The "
|
|
|
|
|
"most fundamental support consists of the types :data:`Any`, :data:`Union`, :"
|
|
|
|
|
"data:`Tuple`, :data:`Callable`, :class:`TypeVar`, and :class:`Generic`. For "
|
|
|
|
|
"full specification please see :pep:`484`. For a simplified introduction to "
|
|
|
|
|
"type hints see :pep:`483`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
2020-05-03 15:12:15 +00:00
|
|
|
|
"Ce module fournit la gestion des annotations de type à l'exécution "
|
|
|
|
|
"conformément à ce qui est spécifié dans les :pep:`484`, :pep:`526`, :pep:"
|
|
|
|
|
"`544`, :pep:`586`, :pep:`589` et :pep:`591`. Le support le plus fondamental "
|
|
|
|
|
"se compose des types :data:`Any`, :data:`Union`, :data:`Tuple`, :data:"
|
|
|
|
|
"`Callable`, :class:`TypeVar` et :class:`Generic`. Pour les spécifications "
|
|
|
|
|
"complètes, voir la :pep:`484`. Pour une introduction simplifiée aux "
|
|
|
|
|
"annotations de type, voir la :pep:`483`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:28
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"The function below takes and returns a string and is annotated as follows::"
|
|
|
|
|
msgstr ""
|
2020-05-03 15:12:15 +00:00
|
|
|
|
"La fonction ci-dessous prend et renvoie une chaîne de caractères, et est "
|
|
|
|
|
"annotée comme suit ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:33
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"In the function ``greeting``, the argument ``name`` is expected to be of "
|
|
|
|
|
"type :class:`str` and the return type :class:`str`. Subtypes are accepted as "
|
|
|
|
|
"arguments."
|
|
|
|
|
msgstr ""
|
2020-05-03 15:12:15 +00:00
|
|
|
|
"La fonction ``greeting`` s'attend à ce que l'argument ``name`` soit de type :"
|
|
|
|
|
"class:`str` et le type de retour :class:`str`. Les sous-types sont acceptés "
|
|
|
|
|
"comme arguments."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:38
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "Type aliases"
|
2020-05-03 15:12:15 +00:00
|
|
|
|
msgstr "Alias de type"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:40
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"A type alias is defined by assigning the type to the alias. In this example, "
|
|
|
|
|
"``Vector`` and ``List[float]`` will be treated as interchangeable synonyms::"
|
|
|
|
|
msgstr ""
|
2020-05-03 15:12:15 +00:00
|
|
|
|
"Un alias de type est défini en assignant le type à l'alias. Dans cet "
|
|
|
|
|
"exemple, ``Vector`` et ``List[float]`` sont traités comme des synonymes "
|
|
|
|
|
"interchangeables ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:52
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Type aliases are useful for simplifying complex type signatures. For "
|
|
|
|
|
"example::"
|
|
|
|
|
msgstr ""
|
2020-05-03 15:12:15 +00:00
|
|
|
|
"Les alias de type sont utiles pour simplifier les signatures complexes. Par "
|
|
|
|
|
"exemple ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:70
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Note that ``None`` as a type hint is a special case and is replaced by "
|
|
|
|
|
"``type(None)``."
|
|
|
|
|
msgstr ""
|
2020-05-03 15:12:15 +00:00
|
|
|
|
"Notez que ``None`` comme indication de type est un cas particulier et est "
|
|
|
|
|
"remplacé par ``type(None)``."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:76
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "NewType"
|
2020-05-03 15:12:15 +00:00
|
|
|
|
msgstr "*NewType*"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:78
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "Use the :func:`NewType` helper function to create distinct types::"
|
|
|
|
|
msgstr ""
|
2020-05-03 15:12:15 +00:00
|
|
|
|
"Aidez-vous de la fonction :func:`NewType` pour créer des types distincts ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:85
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"The static type checker will treat the new type as if it were a subclass of "
|
|
|
|
|
"the original type. This is useful in helping catch logical errors::"
|
|
|
|
|
msgstr ""
|
2020-05-03 15:12:15 +00:00
|
|
|
|
"Le vérificateur de type statique traite le nouveau type comme s'il "
|
|
|
|
|
"s'agissait d'une sous-classe du type original. C'est utile pour aider à "
|
|
|
|
|
"détecter les erreurs logiques ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:97
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"You may still perform all ``int`` operations on a variable of type "
|
|
|
|
|
"``UserId``, but the result will always be of type ``int``. This lets you "
|
|
|
|
|
"pass in a ``UserId`` wherever an ``int`` might be expected, but will prevent "
|
|
|
|
|
"you from accidentally creating a ``UserId`` in an invalid way::"
|
|
|
|
|
msgstr ""
|
2020-05-03 15:12:15 +00:00
|
|
|
|
"Vous pouvez toujours effectuer toutes les opérations applicables à un entier "
|
|
|
|
|
"(type ``int``) sur une variable de type ``UserId``, mais le résultat sera "
|
|
|
|
|
"toujours de type ``int``. Ceci vous permet de passer un ``UserId`` partout "
|
|
|
|
|
"où un ``int`` est attendu, mais vous empêche de créer accidentellement un "
|
|
|
|
|
"``UserId`` d'une manière invalide ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:105
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Note that these checks are enforced only by the static type checker. At "
|
2019-09-04 09:35:23 +00:00
|
|
|
|
"runtime, the statement ``Derived = NewType('Derived', Base)`` will make "
|
2016-10-30 09:46:26 +00:00
|
|
|
|
"``Derived`` a function that immediately returns whatever parameter you pass "
|
|
|
|
|
"it. That means the expression ``Derived(some_value)`` does not create a new "
|
|
|
|
|
"class or introduce any overhead beyond that of a regular function call."
|
|
|
|
|
msgstr ""
|
2020-05-03 15:12:15 +00:00
|
|
|
|
"Notez que ces contrôles ne sont exécutés que par le vérificateur de type "
|
|
|
|
|
"statique. À l'exécution, l'instruction ``Derived = NewType('Derived', "
|
|
|
|
|
"Base)`` fait de ``Derived`` une fonction qui renvoie immédiatement le "
|
|
|
|
|
"paramètre que vous lui passez. Cela signifie que l'expression "
|
|
|
|
|
"``Derived(some_value)`` ne crée pas une nouvelle classe ou n'introduit pas "
|
|
|
|
|
"de surcharge au-delà de celle d'un appel de fonction normal."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:111
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"More precisely, the expression ``some_value is Derived(some_value)`` is "
|
|
|
|
|
"always true at runtime."
|
|
|
|
|
msgstr ""
|
2020-05-03 15:12:15 +00:00
|
|
|
|
"Plus précisément, l'expression ``some_value is Derived(some_value)`` est "
|
|
|
|
|
"toujours vraie au moment de l'exécution."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:114
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"This also means that it is not possible to create a subtype of ``Derived`` "
|
2017-12-01 06:48:13 +00:00
|
|
|
|
"since it is an identity function at runtime, not an actual type::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
2020-05-03 15:12:15 +00:00
|
|
|
|
"Cela signifie également qu'il n'est pas possible de créer un sous-type de "
|
|
|
|
|
"``Derived`` puisqu'il s'agit d'une fonction d'identité au moment de "
|
|
|
|
|
"l'exécution, pas d'un type réel ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:124
|
2017-12-01 06:48:13 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"However, it is possible to create a :func:`NewType` based on a 'derived' "
|
|
|
|
|
"``NewType``::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
2020-05-03 15:12:15 +00:00
|
|
|
|
"Cependant, il est possible de créer un :func:`NewType` basé sur un "
|
|
|
|
|
"``NewType`` « dérivé » ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:132
|
2017-12-01 06:48:13 +00:00
|
|
|
|
msgid "and typechecking for ``ProUserId`` will work as expected."
|
2020-05-03 15:12:15 +00:00
|
|
|
|
msgstr "et la vérification de type pour ``ProUserId`` fonctionne comme prévu."
|
2017-12-01 06:48:13 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:134
|
2017-12-01 06:48:13 +00:00
|
|
|
|
msgid "See :pep:`484` for more details."
|
2020-05-03 15:12:15 +00:00
|
|
|
|
msgstr "Voir la :pep:`484` pour plus de détails."
|
2017-12-01 06:48:13 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:138
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Recall that the use of a type alias declares two types to be *equivalent* to "
|
|
|
|
|
"one another. Doing ``Alias = Original`` will make the static type checker "
|
|
|
|
|
"treat ``Alias`` as being *exactly equivalent* to ``Original`` in all cases. "
|
|
|
|
|
"This is useful when you want to simplify complex type signatures."
|
|
|
|
|
msgstr ""
|
2020-05-03 15:12:15 +00:00
|
|
|
|
"Rappelons que l'utilisation d'un alias de type déclare que deux types sont "
|
|
|
|
|
"*équivalents* l'un à l'autre. Écrire ``Alias = Original`` fait que le "
|
|
|
|
|
"vérificateur de type statique traite ``Alias`` comme étant *exactement "
|
|
|
|
|
"équivalent* à ``Original`` dans tous les cas. C'est utile lorsque vous "
|
|
|
|
|
"voulez simplifier des signatures complexes."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:143
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"In contrast, ``NewType`` declares one type to be a *subtype* of another. "
|
|
|
|
|
"Doing ``Derived = NewType('Derived', Original)`` will make the static type "
|
|
|
|
|
"checker treat ``Derived`` as a *subclass* of ``Original``, which means a "
|
|
|
|
|
"value of type ``Original`` cannot be used in places where a value of type "
|
|
|
|
|
"``Derived`` is expected. This is useful when you want to prevent logic "
|
|
|
|
|
"errors with minimal runtime cost."
|
|
|
|
|
msgstr ""
|
2020-05-03 15:12:15 +00:00
|
|
|
|
"En revanche, ``NewType`` déclare qu'un type est un *sous-type* d'un autre. "
|
|
|
|
|
"Écrire ``Derived = NewType('Derived', Original)`` fait en sorte que le "
|
|
|
|
|
"vérificateur de type statique traite ``Derived`` comme une *sous-classe* de "
|
|
|
|
|
"``Original``, ce qui signifie qu'une valeur de type ``Original`` ne peut "
|
|
|
|
|
"être utilisée dans les endroits où une valeur de type ``Derived`` est "
|
|
|
|
|
"prévue. C'est utile lorsque vous voulez éviter les erreurs logiques avec un "
|
|
|
|
|
"coût d'exécution minimal."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:153
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "Callable"
|
2020-05-03 15:12:15 +00:00
|
|
|
|
msgstr "Appelable"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:155
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Frameworks expecting callback functions of specific signatures might be type "
|
|
|
|
|
"hinted using ``Callable[[Arg1Type, Arg2Type], ReturnType]``."
|
|
|
|
|
msgstr ""
|
2020-05-03 15:12:15 +00:00
|
|
|
|
"Les cadriciels (*frameworks* en anglais) qui attendent des fonctions de "
|
|
|
|
|
"rappel ayant des signatures spécifiques peuvent être typés en utilisant "
|
|
|
|
|
"``Callable[[Arg1Type, Arg2Type], ReturnType]``."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:158
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "For example::"
|
2018-07-03 09:49:47 +00:00
|
|
|
|
msgstr "Par exemple ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:169
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"It is possible to declare the return type of a callable without specifying "
|
|
|
|
|
"the call signature by substituting a literal ellipsis for the list of "
|
|
|
|
|
"arguments in the type hint: ``Callable[..., ReturnType]``."
|
|
|
|
|
msgstr ""
|
2020-05-03 15:12:15 +00:00
|
|
|
|
"Il est possible de déclarer le type de retour d'un appelable sans spécifier "
|
|
|
|
|
"la signature de l'appel en indiquant des points de suspension à la liste des "
|
|
|
|
|
"arguments dans l'indice de type : ``Callable[..., ReturnType]``."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:176
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "Generics"
|
2020-05-03 15:12:15 +00:00
|
|
|
|
msgstr "Génériques"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:178
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Since type information about objects kept in containers cannot be statically "
|
|
|
|
|
"inferred in a generic way, abstract base classes have been extended to "
|
|
|
|
|
"support subscription to denote expected types for container elements."
|
|
|
|
|
msgstr ""
|
2020-05-03 15:12:15 +00:00
|
|
|
|
"Comme les informations de type sur les objets conservés dans des conteneurs "
|
|
|
|
|
"ne peuvent pas être déduites statiquement de manière générique, les classes "
|
|
|
|
|
"de base abstraites ont été étendues pour prendre en charge la sélection "
|
|
|
|
|
"(*subscription* en anglais) et indiquer les types attendus pour les éléments "
|
|
|
|
|
"de conteneur."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:189
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
2018-10-13 15:54:03 +00:00
|
|
|
|
"Generics can be parameterized by using a new factory available in typing "
|
2016-10-30 09:46:26 +00:00
|
|
|
|
"called :class:`TypeVar`."
|
|
|
|
|
msgstr ""
|
2020-05-03 15:12:15 +00:00
|
|
|
|
"Les génériques peuvent être paramétrés en utilisant une nouvelle fabrique "
|
|
|
|
|
"(au sens des patrons de conception) disponible en tapant :class:`TypeVar`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:203
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "User-defined generic types"
|
2020-05-03 15:12:15 +00:00
|
|
|
|
msgstr "Types génériques définis par l'utilisateur"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:205
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "A user-defined class can be defined as a generic class."
|
|
|
|
|
msgstr ""
|
2020-05-03 15:12:15 +00:00
|
|
|
|
"Une classe définie par l'utilisateur peut être définie comme une classe "
|
|
|
|
|
"générique."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:231
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"``Generic[T]`` as a base class defines that the class ``LoggedVar`` takes a "
|
|
|
|
|
"single type parameter ``T`` . This also makes ``T`` valid as a type within "
|
|
|
|
|
"the class body."
|
|
|
|
|
msgstr ""
|
2020-05-03 15:12:15 +00:00
|
|
|
|
"``Generic[T]`` en tant que classe de base définit que la classe "
|
|
|
|
|
"``LoggedVar`` prend un paramètre de type unique ``T``. Ceci rend également "
|
|
|
|
|
"``T`` valide en tant que type dans le corps de la classe."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:235
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
2019-11-15 22:57:16 +00:00
|
|
|
|
"The :class:`Generic` base class defines :meth:`__class_getitem__` so that "
|
|
|
|
|
"``LoggedVar[t]`` is valid as a type::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
2020-05-03 15:12:15 +00:00
|
|
|
|
"La classe de base :class:`Generic` définit :meth:`__class_getitem__` de "
|
|
|
|
|
"sorte que ``LoggedVar[t]`` est valide comme type ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:244
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"A generic type can have any number of type variables, and type variables may "
|
|
|
|
|
"be constrained::"
|
|
|
|
|
msgstr ""
|
2020-05-03 15:12:15 +00:00
|
|
|
|
"Un type générique peut avoir un nombre quelconque de variables de type et "
|
|
|
|
|
"vous pouvez fixer des contraintes sur les variables de type ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:256
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Each type variable argument to :class:`Generic` must be distinct. This is "
|
|
|
|
|
"thus invalid::"
|
|
|
|
|
msgstr ""
|
2020-05-03 15:12:15 +00:00
|
|
|
|
"Chaque argument de variable de type :class:`Generic` doit être distinct. "
|
|
|
|
|
"Ceci n'est donc pas valable ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:267
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "You can use multiple inheritance with :class:`Generic`::"
|
2020-05-03 15:12:15 +00:00
|
|
|
|
msgstr "Vous pouvez utiliser l'héritage multiple avec :class:`Generic` ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:276
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"When inheriting from generic classes, some type variables could be fixed::"
|
|
|
|
|
msgstr ""
|
2020-05-03 15:12:15 +00:00
|
|
|
|
"Lors de l'héritage de classes génériques, certaines variables de type "
|
|
|
|
|
"peuvent être corrigées ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:285
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "In this case ``MyDict`` has a single parameter, ``T``."
|
2020-05-03 15:12:15 +00:00
|
|
|
|
msgstr "Dans ce cas, ``MyDict`` a un seul paramètre, ``T``."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:287
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Using a generic class without specifying type parameters assumes :data:`Any` "
|
|
|
|
|
"for each position. In the following example, ``MyIterable`` is not generic "
|
|
|
|
|
"but implicitly inherits from ``Iterable[Any]``::"
|
|
|
|
|
msgstr ""
|
2020-05-03 15:12:15 +00:00
|
|
|
|
"L'utilisation d'une classe générique sans spécifier de paramètres de type "
|
|
|
|
|
"suppose :data:`Any` pour chaque position. Dans l'exemple suivant, "
|
|
|
|
|
"``MyIterable`` n'est pas générique mais hérite implicitement de "
|
|
|
|
|
"``Iterable[Any]`` ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:295
|
2017-04-02 20:14:06 +00:00
|
|
|
|
msgid "User defined generic type aliases are also supported. Examples::"
|
|
|
|
|
msgstr ""
|
2020-05-03 15:12:15 +00:00
|
|
|
|
"Les alias de type générique définis par l'utilisateur sont également pris en "
|
|
|
|
|
"charge. Exemples ::"
|
2017-04-02 20:14:06 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:311
|
2019-11-15 22:57:16 +00:00
|
|
|
|
msgid ":class:`Generic` no longer has a custom metaclass."
|
2020-05-03 15:12:15 +00:00
|
|
|
|
msgstr ":class:`Generic` n'a plus de métaclasse personnalisée."
|
2019-11-15 22:57:16 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:314
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
2019-11-15 22:57:16 +00:00
|
|
|
|
"A user-defined generic class can have ABCs as base classes without a "
|
2016-10-30 09:46:26 +00:00
|
|
|
|
"metaclass conflict. Generic metaclasses are not supported. The outcome of "
|
|
|
|
|
"parameterizing generics is cached, and most types in the typing module are "
|
|
|
|
|
"hashable and comparable for equality."
|
|
|
|
|
msgstr ""
|
2020-05-03 15:12:15 +00:00
|
|
|
|
"Une classe générique définie par l'utilisateur peut avoir des CBA (*Classe "
|
|
|
|
|
"de Base Abstraite*) comme classes de base sans conflit de métaclasses. Les "
|
|
|
|
|
"métaclasses génériques ne sont pas prises en charge. Le résultat du "
|
|
|
|
|
"paramétrage des génériques est mis en cache et la plupart des types dans le "
|
|
|
|
|
"module ``typing`` sont hachables et comparables pour l'égalité."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:321
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "The :data:`Any` type"
|
2020-05-03 15:12:15 +00:00
|
|
|
|
msgstr "Le type :data:`Any`"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:323
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"A special kind of type is :data:`Any`. A static type checker will treat "
|
|
|
|
|
"every type as being compatible with :data:`Any` and :data:`Any` as being "
|
|
|
|
|
"compatible with every type."
|
|
|
|
|
msgstr ""
|
2020-05-03 15:12:15 +00:00
|
|
|
|
"Un type particulier est :data:`Any`. Un vérificateur de type statique traite "
|
|
|
|
|
"chaque type comme étant compatible avec :data:`Any` et :data:`Any` comme "
|
|
|
|
|
"étant compatible avec chaque type."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:327
|
|
|
|
|
#, fuzzy
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"This means that it is possible to perform any operation or method call on a "
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"value of type :data:`Any` and assign it to any variable::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
2020-05-03 15:12:15 +00:00
|
|
|
|
"Cela signifie qu'il est possible d'effectuer n'importe quelle opération ou "
|
|
|
|
|
"appel de méthode sur une valeur de type :data:`Any` et de l'affecter à "
|
|
|
|
|
"n'importe quelle variable ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:345
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Notice that no typechecking is performed when assigning a value of type :"
|
|
|
|
|
"data:`Any` to a more precise type. For example, the static type checker did "
|
|
|
|
|
"not report an error when assigning ``a`` to ``s`` even though ``s`` was "
|
|
|
|
|
"declared to be of type :class:`str` and receives an :class:`int` value at "
|
|
|
|
|
"runtime!"
|
|
|
|
|
msgstr ""
|
2020-05-03 15:12:15 +00:00
|
|
|
|
"Notez qu'aucun contrôle de typage n'est effectué lors de l'affectation d'une "
|
|
|
|
|
"valeur de type :data:`Any` à un type plus précis. Par exemple, le "
|
|
|
|
|
"vérificateur de type statique ne signale pas d'erreur lors de l'affectation "
|
|
|
|
|
"de ``a`` à ``s`` même si ``s`` était déclaré être de type :class:`str` et "
|
|
|
|
|
"reçoit une valeur :class:`int` au moment de son exécution !"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:351
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Furthermore, all functions without a return type or parameter types will "
|
|
|
|
|
"implicitly default to using :data:`Any`::"
|
|
|
|
|
msgstr ""
|
2020-05-03 15:12:15 +00:00
|
|
|
|
"De plus, toutes les fonctions sans type de retour ni type de paramètre sont "
|
|
|
|
|
"considérées comme utilisant :data:`Any` implicitement par défaut ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:364
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"This behavior allows :data:`Any` to be used as an *escape hatch* when you "
|
|
|
|
|
"need to mix dynamically and statically typed code."
|
|
|
|
|
msgstr ""
|
2020-05-03 15:12:15 +00:00
|
|
|
|
"Ce comportement permet à :data:`Any` d'être utilisé comme succédané lorsque "
|
|
|
|
|
"vous avez besoin de mélanger du code typé dynamiquement et statiquement."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:367
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Contrast the behavior of :data:`Any` with the behavior of :class:`object`. "
|
|
|
|
|
"Similar to :data:`Any`, every type is a subtype of :class:`object`. However, "
|
|
|
|
|
"unlike :data:`Any`, the reverse is not true: :class:`object` is *not* a "
|
|
|
|
|
"subtype of every other type."
|
|
|
|
|
msgstr ""
|
2020-05-03 15:12:15 +00:00
|
|
|
|
"Comparons le comportement de :data:`Any` avec celui de :class:`object`. De "
|
|
|
|
|
"la même manière que pour :data:`Any`, chaque type est un sous-type de :class:"
|
|
|
|
|
"`object`. Cependant, contrairement à :data:`Any`, l'inverse n'est pas "
|
|
|
|
|
"vrai : :class:`object` n'est *pas* un sous-type de chaque autre type."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:372
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"That means when the type of a value is :class:`object`, a type checker will "
|
|
|
|
|
"reject almost all operations on it, and assigning it to a variable (or using "
|
|
|
|
|
"it as a return value) of a more specialized type is a type error. For "
|
|
|
|
|
"example::"
|
|
|
|
|
msgstr ""
|
2020-05-03 15:12:15 +00:00
|
|
|
|
"Cela signifie que lorsque le type d'une valeur est :class:`object`, un "
|
|
|
|
|
"vérificateur de type rejette presque toutes les opérations sur celle-ci, et "
|
|
|
|
|
"l'affecter à une variable (ou l'utiliser comme une valeur de retour) d'un "
|
|
|
|
|
"type plus spécialisé est une erreur de typage. Par exemple ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:394
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Use :class:`object` to indicate that a value could be any type in a typesafe "
|
|
|
|
|
"manner. Use :data:`Any` to indicate that a value is dynamically typed."
|
|
|
|
|
msgstr ""
|
2020-05-03 15:12:15 +00:00
|
|
|
|
"Utilisez :class:`object` pour indiquer qu'une valeur peut être de n'importe "
|
|
|
|
|
"quel type de manière sûre. Utiliser :data:`Any` pour indiquer qu'une valeur "
|
|
|
|
|
"est typée dynamiquement."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:399
|
2019-09-04 09:35:23 +00:00
|
|
|
|
msgid "Nominal vs structural subtyping"
|
2020-05-03 15:12:15 +00:00
|
|
|
|
msgstr "Sous-typage nominal et sous-typage structurel"
|
2019-09-04 09:35:23 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:401
|
2019-09-04 09:35:23 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Initially :pep:`484` defined Python static type system as using *nominal "
|
|
|
|
|
"subtyping*. This means that a class ``A`` is allowed where a class ``B`` is "
|
|
|
|
|
"expected if and only if ``A`` is a subclass of ``B``."
|
|
|
|
|
msgstr ""
|
2020-05-03 15:12:15 +00:00
|
|
|
|
"Initialement la :pep:`484` définissait le système de type statique Python "
|
|
|
|
|
"comme utilisant *le sous-type nominal*. Cela signifie qu'une classe ``A`` "
|
|
|
|
|
"est permise lorsqu'une classe ``B`` est prévue si et seulement si ``A`` est "
|
|
|
|
|
"une sous-classe de ``B``."
|
2019-09-04 09:35:23 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:405
|
2019-09-04 09:35:23 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"This requirement previously also applied to abstract base classes, such as :"
|
|
|
|
|
"class:`Iterable`. The problem with this approach is that a class had to be "
|
|
|
|
|
"explicitly marked to support them, which is unpythonic and unlike what one "
|
|
|
|
|
"would normally do in idiomatic dynamically typed Python code. For example, "
|
|
|
|
|
"this conforms to the :pep:`484`::"
|
|
|
|
|
msgstr ""
|
2020-05-03 15:12:15 +00:00
|
|
|
|
"Ce pré-requis s'appliquait auparavant aussi aux classes de base abstraites, "
|
|
|
|
|
"telles que :class:`Iterable`. Le problème avec cette approche est qu'une "
|
|
|
|
|
"classe devait être explicitement marquée pour les supporter, ce qui n'est "
|
|
|
|
|
"pas *pythonique* et diffère de ce que l'on ferait normalement avec du code "
|
|
|
|
|
"Python idiomatique typé dynamiquement. Par exemple, ceci est conforme à la :"
|
|
|
|
|
"pep:`484` ::"
|
2019-09-04 09:35:23 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:418
|
2019-09-04 09:35:23 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
":pep:`544` allows to solve this problem by allowing users to write the above "
|
|
|
|
|
"code without explicit base classes in the class definition, allowing "
|
|
|
|
|
"``Bucket`` to be implicitly considered a subtype of both ``Sized`` and "
|
|
|
|
|
"``Iterable[int]`` by static type checkers. This is known as *structural "
|
|
|
|
|
"subtyping* (or static duck-typing)::"
|
|
|
|
|
msgstr ""
|
2020-05-03 15:12:15 +00:00
|
|
|
|
"La :pep:`544` permet de résoudre ce problème en permettant aux utilisateurs "
|
|
|
|
|
"d'écrire le code ci-dessus sans classes de base explicites dans la "
|
|
|
|
|
"définition de classe, permettant à ``Bucket`` d'être implicitement considéré "
|
|
|
|
|
"comme un sous-type de ``Sized`` et ``Iterable[int]`` par des vérificateurs "
|
|
|
|
|
"de type statique. C'est ce qu'on appelle le *sous-typage structurel* (ou "
|
|
|
|
|
"typage canard) ::"
|
2019-09-04 09:35:23 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:434
|
2019-09-04 09:35:23 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Moreover, by subclassing a special class :class:`Protocol`, a user can "
|
|
|
|
|
"define new custom protocols to fully enjoy structural subtyping (see "
|
|
|
|
|
"examples below)."
|
|
|
|
|
msgstr ""
|
2020-05-03 15:12:15 +00:00
|
|
|
|
"De plus, en sous-classant une classe spéciale :class:`Protocol`, un "
|
|
|
|
|
"utilisateur peut définir de nouveaux protocoles personnalisés pour profiter "
|
|
|
|
|
"pleinement du sous-typage structurel (voir exemples ci-dessous)."
|
2019-09-04 09:35:23 +00:00
|
|
|
|
|
2020-07-20 08:45:25 +00:00
|
|
|
|
#: library/typing.rst:439
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgid "Module contents"
|
|
|
|
|
msgstr ""
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-07-20 08:45:25 +00:00
|
|
|
|
#: library/typing.rst:441
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "The module defines the following classes, functions and decorators."
|
2020-05-03 15:12:15 +00:00
|
|
|
|
msgstr "Ce module définit les classes, fonctions et décorateurs suivants :"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-07-20 08:45:25 +00:00
|
|
|
|
#: library/typing.rst:445
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"This module defines several types that are subclasses of pre-existing "
|
|
|
|
|
"standard library classes which also extend :class:`Generic` to support type "
|
|
|
|
|
"variables inside ``[]``. These types became redundant in Python 3.9 when the "
|
|
|
|
|
"corresponding pre-existing classes were enhanced to support ``[]``."
|
|
|
|
|
msgstr ""
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:451
|
|
|
|
|
msgid ""
|
|
|
|
|
"The redundant types are deprecated as of Python 3.9 but no deprecation "
|
|
|
|
|
"warnings will be issued by the interpreter. It is expected that type "
|
|
|
|
|
"checkers will flag the deprecated types when the checked program targets "
|
|
|
|
|
"Python 3.9 or newer."
|
|
|
|
|
msgstr ""
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:456
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"The deprecated types will be removed from the :mod:`typing` module in the "
|
|
|
|
|
"first Python version released 5 years after the release of Python 3.9.0. See "
|
|
|
|
|
"details in :pep:`585`—*Type Hinting Generics In Standard Collections*."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:462
|
|
|
|
|
msgid "Special typing primitives"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2020-07-20 08:45:25 +00:00
|
|
|
|
#: library/typing.rst:465
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "Special types"
|
|
|
|
|
msgstr "Type « optionnel »."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:467
|
|
|
|
|
msgid "These can be used as types in annotations and do not support ``[]``."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:471
|
|
|
|
|
msgid "Special type indicating an unconstrained type."
|
|
|
|
|
msgstr "Type spécial indiquant un type non contraint."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:473
|
|
|
|
|
msgid "Every type is compatible with :data:`Any`."
|
|
|
|
|
msgstr "Chaque type est compatible avec :data:`Any`."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:474
|
|
|
|
|
msgid ":data:`Any` is compatible with every type."
|
|
|
|
|
msgstr ":data:`Any` est compatible avec tous les types."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:478
|
|
|
|
|
msgid "Special type indicating that a function never returns. For example::"
|
|
|
|
|
msgstr "Type spécial indiquant qu'une fonction ne renvoie rien. Par exemple ::"
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:490
|
|
|
|
|
msgid "Special forms"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:492
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"These can be used as types in annotations using ``[]``, each having a unique "
|
|
|
|
|
"syntax."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:496
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"Tuple type; ``Tuple[X, Y]`` is the type of a tuple of two items with the "
|
|
|
|
|
"first item of type X and the second of type Y. The type of the empty tuple "
|
|
|
|
|
"can be written as ``Tuple[()]``."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"Type « n-uplet » ; ``Tuple[X, Y]`` est le type d'un n-uplet à deux éléments "
|
|
|
|
|
"avec le premier élément de type X et le second de type Y. Le type du n-uplet "
|
|
|
|
|
"vide peut être écrit comme ``Tuple[()]``."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:500
|
|
|
|
|
msgid ""
|
|
|
|
|
"Example: ``Tuple[T1, T2]`` is a tuple of two elements corresponding to type "
|
|
|
|
|
"variables T1 and T2. ``Tuple[int, float, str]`` is a tuple of an int, a "
|
|
|
|
|
"float and a string."
|
|
|
|
|
msgstr ""
|
|
|
|
|
"Exemple : ``Tuple[T1, T2]`` est une paire correspondant aux variables de "
|
|
|
|
|
"type ``T1`` et ``T2``. ``Tuple[int, float, str]`` est un triplet composé "
|
|
|
|
|
"d'un entier, d'un flottant et d'une chaîne de caractères."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:504
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"To specify a variable-length tuple of homogeneous type, use literal "
|
|
|
|
|
"ellipsis, e.g. ``Tuple[int, ...]``. A plain :data:`Tuple` is equivalent to "
|
|
|
|
|
"``Tuple[Any, ...]``, and in turn to :class:`tuple`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"Pour spécifier un n-uplet de longueur variable et de type homogène, utilisez "
|
|
|
|
|
"une ellipse, par exemple ``Tuple[int, ....]``. Un n-uplet :data:`Tuple` est "
|
|
|
|
|
"équivalent à ``Tuple[Any, ....]`` et, à son tour, à :class:`tuple`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:508
|
|
|
|
|
msgid ":class:`builtins.tuple <tuple>` now supports ``[]``. See :pep:`585`."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:513
|
|
|
|
|
msgid "Union type; ``Union[X, Y]`` means either X or Y."
|
|
|
|
|
msgstr "Type « union » ; ``Union[X, Y]`` signifie X ou Y."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:515
|
|
|
|
|
msgid "To define a union, use e.g. ``Union[int, str]``. Details:"
|
|
|
|
|
msgstr ""
|
|
|
|
|
"Pour définir une union, utilisez par exemple ``Union[int, str]``. Détail :"
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:517
|
|
|
|
|
msgid "The arguments must be types and there must be at least one."
|
|
|
|
|
msgstr ""
|
|
|
|
|
"Les arguments doivent être des types et il doit y en avoir au moins un."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:519
|
|
|
|
|
msgid "Unions of unions are flattened, e.g.::"
|
|
|
|
|
msgstr "Les unions d'unions sont aplanies, par exemple ::"
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:523
|
|
|
|
|
msgid "Unions of a single argument vanish, e.g.::"
|
|
|
|
|
msgstr "Les unions d'un seul argument disparaissent, par exemple ::"
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:527
|
|
|
|
|
msgid "Redundant arguments are skipped, e.g.::"
|
|
|
|
|
msgstr "Les arguments redondants sont ignorés, par exemple ::"
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:531
|
|
|
|
|
msgid "When comparing unions, the argument order is ignored, e.g.::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
"Lors de la comparaison d'unions, l'ordre des arguments est ignoré, par "
|
|
|
|
|
"exemple ::"
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:535
|
|
|
|
|
msgid "You cannot subclass or instantiate a union."
|
|
|
|
|
msgstr "Vous ne pouvez pas sous-classer ou instancier une union."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:537
|
|
|
|
|
msgid "You cannot write ``Union[X][Y]``."
|
|
|
|
|
msgstr "Vous ne pouvez pas écrire ``Union[X][Y]``."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:539
|
|
|
|
|
msgid "You can use ``Optional[X]`` as a shorthand for ``Union[X, None]``."
|
|
|
|
|
msgstr ""
|
|
|
|
|
"Vous pouvez utiliser l'abréviation ``Optional[X]`` pour ``Union[X, None]``."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:541
|
|
|
|
|
msgid "Don't remove explicit subclasses from unions at runtime."
|
|
|
|
|
msgstr "Ne supprime pas les sous-classes explicites des unions à l'exécution."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:546
|
|
|
|
|
msgid "Optional type."
|
|
|
|
|
msgstr "Type « optionnel »."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:548
|
|
|
|
|
msgid "``Optional[X]`` is equivalent to ``Union[X, None]``."
|
|
|
|
|
msgstr "``Optional[X]`` équivaut à ``Union[X, None]``."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:550
|
2019-09-04 09:35:23 +00:00
|
|
|
|
msgid ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"Note that this is not the same concept as an optional argument, which is one "
|
|
|
|
|
"that has a default. An optional argument with a default does not require "
|
|
|
|
|
"the ``Optional`` qualifier on its type annotation just because it is "
|
|
|
|
|
"optional. For example::"
|
2019-09-04 09:35:23 +00:00
|
|
|
|
msgstr ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"Notez que ce n'est pas le même concept qu'un argument optionnel, qui est un "
|
|
|
|
|
"argument qui possède une valeur par défaut. Un argument optionnel (qui a une "
|
|
|
|
|
"valeur par défaut) ne nécessite pas, à ce titre, le qualificatif "
|
|
|
|
|
"``Optional`` sur son annotation de type. Par exemple ::"
|
2019-09-04 09:35:23 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:558
|
2019-09-04 09:35:23 +00:00
|
|
|
|
msgid ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"On the other hand, if an explicit value of ``None`` is allowed, the use of "
|
|
|
|
|
"``Optional`` is appropriate, whether the argument is optional or not. For "
|
|
|
|
|
"example::"
|
2019-09-04 09:35:23 +00:00
|
|
|
|
msgstr ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"Par contre, si une valeur explicite de ``None`` est permise, l'utilisation "
|
|
|
|
|
"de ``Optional`` est appropriée, que l'argument soit facultatif ou non. Par "
|
|
|
|
|
"exemple ::"
|
2019-09-04 09:35:23 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:567
|
|
|
|
|
msgid "Callable type; ``Callable[[int], str]`` is a function of (int) -> str."
|
|
|
|
|
msgstr ""
|
|
|
|
|
"Type Appelable. ``Callable[[int], str]`` est une fonction de type ``(int) -> "
|
|
|
|
|
"str``."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:569
|
2019-09-04 09:35:23 +00:00
|
|
|
|
msgid ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"The subscription syntax must always be used with exactly two values: the "
|
|
|
|
|
"argument list and the return type. The argument list must be a list of "
|
|
|
|
|
"types or an ellipsis; the return type must be a single type."
|
2019-09-04 09:35:23 +00:00
|
|
|
|
msgstr ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"La syntaxe de sélection (*subscription* en anglais) doit toujours être "
|
|
|
|
|
"utilisée avec exactement deux valeurs : la liste d'arguments et le type de "
|
|
|
|
|
"retour. La liste d'arguments doit être une liste de types ou une ellipse ; "
|
|
|
|
|
"il doit y avoir un seul type de retour."
|
2019-09-04 09:35:23 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:574
|
|
|
|
|
msgid ""
|
|
|
|
|
"There is no syntax to indicate optional or keyword arguments; such function "
|
|
|
|
|
"types are rarely used as callback types. ``Callable[..., ReturnType]`` "
|
|
|
|
|
"(literal ellipsis) can be used to type hint a callable taking any number of "
|
|
|
|
|
"arguments and returning ``ReturnType``. A plain :data:`Callable` is "
|
|
|
|
|
"equivalent to ``Callable[..., Any]``, and in turn to :class:`collections.abc."
|
|
|
|
|
"Callable`."
|
|
|
|
|
msgstr ""
|
|
|
|
|
"Il n'y a pas de syntaxe pour indiquer les arguments optionnels ou les "
|
|
|
|
|
"arguments par mots-clés ; de tels types de fonctions sont rarement utilisés "
|
|
|
|
|
"comme types de rappel. ``Callable[..., ReturnType]`` (ellipse) peut être "
|
|
|
|
|
"utilisé pour annoter le type d'un appelable, prenant un nombre quelconque "
|
|
|
|
|
"d'arguments et renvoyant ``ReturnType``. Un simple :data:`Callable` est "
|
|
|
|
|
"équivalent à ``Callable[..., Any]`` et, à son tour, à :class:`collections."
|
|
|
|
|
"abc.Callable`."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:582
|
|
|
|
|
msgid ":class:`collections.abc.Callable` now supports ``[]``. See :pep:`585`."
|
|
|
|
|
msgstr ""
|
2019-09-04 09:35:23 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:587
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"A variable annotated with ``C`` may accept a value of type ``C``. In "
|
|
|
|
|
"contrast, a variable annotated with ``Type[C]`` may accept values that are "
|
|
|
|
|
"classes themselves -- specifically, it will accept the *class object* of "
|
|
|
|
|
"``C``. For example::"
|
|
|
|
|
msgstr ""
|
2020-05-03 15:12:15 +00:00
|
|
|
|
"Une variable annotée de ``C`` peut accepter une valeur de type ``C``. En "
|
|
|
|
|
"revanche, une variable annotée avec ``Type[C]`` peut accepter des valeurs "
|
|
|
|
|
"qui sont elles-mêmes des classes — plus précisément, elle accepte l'objet "
|
|
|
|
|
"*class* de ``C``. Par exemple ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:596
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "Note that ``Type[C]`` is covariant::"
|
2020-05-03 15:12:15 +00:00
|
|
|
|
msgstr "Notez que ``Type[C]`` est covariant ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:608
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"The fact that ``Type[C]`` is covariant implies that all subclasses of ``C`` "
|
|
|
|
|
"should implement the same constructor signature and class method signatures "
|
|
|
|
|
"as ``C``. The type checker should flag violations of this, but should also "
|
|
|
|
|
"allow constructor calls in subclasses that match the constructor calls in "
|
|
|
|
|
"the indicated base class. How the type checker is required to handle this "
|
|
|
|
|
"particular case may change in future revisions of :pep:`484`."
|
|
|
|
|
msgstr ""
|
2020-05-03 15:12:15 +00:00
|
|
|
|
"Le fait que ``Type[C]`` soit covariant implique que toutes les sous-classes "
|
|
|
|
|
"de ``C`` doivent implémenter la même signature de constructeur et les "
|
|
|
|
|
"signatures de méthode de classe que ``C``. Le vérificateur de type doit "
|
|
|
|
|
"signaler les manquements à cette règle. Il doit également autoriser les "
|
|
|
|
|
"appels du constructeur dans les sous-classes qui correspondent aux appels du "
|
|
|
|
|
"constructeur dans la classe de base indiquée. La façon dont le vérificateur "
|
|
|
|
|
"de type est tenu de traiter ce cas particulier peut changer dans les futures "
|
|
|
|
|
"révisions de :pep:`484`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:616
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
2018-10-13 15:54:03 +00:00
|
|
|
|
"The only legal parameters for :class:`Type` are classes, :data:`Any`, :ref:"
|
|
|
|
|
"`type variables <generics>`, and unions of any of these types. For example::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
2020-05-03 15:12:15 +00:00
|
|
|
|
"Les seuls paramètres légitimes pour :class:`Type` sont les classes, :data:"
|
|
|
|
|
"`Any`, :ref:`type variables <generics>`, et les unions de ces types. Par "
|
|
|
|
|
"exemple ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:622
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"``Type[Any]`` is equivalent to ``Type`` which in turn is equivalent to "
|
|
|
|
|
"``type``, which is the root of Python's metaclass hierarchy."
|
|
|
|
|
msgstr ""
|
2020-05-03 15:12:15 +00:00
|
|
|
|
"``Type[Any]`` est équivalent à ``Type`` qui à son tour est équivalent à "
|
|
|
|
|
"``type``, qui est la racine de la hiérarchie des métaclasses de Python."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:627
|
|
|
|
|
msgid ":class:`builtins.type <type>` now supports ``[]``. See :pep:`585`."
|
|
|
|
|
msgstr ""
|
2019-09-04 09:35:23 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:632
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"A type that can be used to indicate to type checkers that the corresponding "
|
|
|
|
|
"variable or function parameter has a value equivalent to the provided "
|
|
|
|
|
"literal (or one of several literals). For example::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"Type pour indiquer aux vérificateurs de type que la variable ou le paramètre "
|
|
|
|
|
"de fonction correspondant a une valeur équivalente au littéral fourni (ou un "
|
|
|
|
|
"parmi plusieurs littéraux). Par exemple ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:646
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"``Literal[...]`` cannot be subclassed. At runtime, an arbitrary value is "
|
|
|
|
|
"allowed as type argument to ``Literal[...]``, but type checkers may impose "
|
|
|
|
|
"restrictions. See :pep:`586` for more details about literal types."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"``Literal[...]`` ne peut être sous-classé. Lors de l'exécution, une valeur "
|
|
|
|
|
"arbitraire est autorisée comme argument de type pour ``Literal[...]``, mais "
|
|
|
|
|
"les vérificateurs de type peuvent imposer des restrictions. Voir la :pep:"
|
|
|
|
|
"`586` pour plus de détails sur les types littéraux."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:654
|
|
|
|
|
msgid "Special type construct to mark class variables."
|
|
|
|
|
msgstr ""
|
|
|
|
|
"Construction de type particulière pour indiquer les variables de classe."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:656
|
|
|
|
|
msgid ""
|
|
|
|
|
"As introduced in :pep:`526`, a variable annotation wrapped in ClassVar "
|
|
|
|
|
"indicates that a given attribute is intended to be used as a class variable "
|
|
|
|
|
"and should not be set on instances of that class. Usage::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
"Telle qu'introduite dans la :pep:`526`, une annotation de variable "
|
|
|
|
|
"enveloppée dans ClassVar indique qu'un attribut donné est destiné à être "
|
|
|
|
|
"utilisé comme une variable de classe et ne doit pas être défini sur des "
|
|
|
|
|
"instances de cette classe. Utilisation ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:664
|
|
|
|
|
msgid ":data:`ClassVar` accepts only types and cannot be further subscribed."
|
|
|
|
|
msgstr ":data:`ClassVar` n'accepte que les types et ne peut plus être dérivé."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:666
|
|
|
|
|
msgid ""
|
|
|
|
|
":data:`ClassVar` is not a class itself, and should not be used with :func:"
|
|
|
|
|
"`isinstance` or :func:`issubclass`. :data:`ClassVar` does not change Python "
|
|
|
|
|
"runtime behavior, but it can be used by third-party type checkers. For "
|
|
|
|
|
"example, a type checker might flag the following code as an error::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
":data:`ClassVar` n'est pas une classe en soi, et ne devrait pas être "
|
|
|
|
|
"utilisée avec :func:`isinstance` ou :func:`issubclass`. :data:`ClassVar` ne "
|
|
|
|
|
"modifie pas le comportement d'exécution Python, mais il peut être utilisé "
|
|
|
|
|
"par des vérificateurs tiers. Par exemple, un vérificateur de type peut "
|
|
|
|
|
"marquer le code suivant comme une erreur ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:680
|
|
|
|
|
msgid ""
|
|
|
|
|
"A special typing construct to indicate to type checkers that a name cannot "
|
|
|
|
|
"be re-assigned or overridden in a subclass. For example::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
"Construction de type particulière pour indiquer aux vérificateurs de type "
|
|
|
|
|
"qu'un nom ne peut pas être réassigné ou remplacé dans une sous-classe. Par "
|
|
|
|
|
"exemple ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:692 library/typing.rst:1570
|
2019-01-04 23:29:24 +00:00
|
|
|
|
msgid ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"There is no runtime checking of these properties. See :pep:`591` for more "
|
|
|
|
|
"details."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"Ces propriétés ne sont pas vérifiées à l'exécution. Voir la :pep:`591` pour "
|
|
|
|
|
"plus de détails."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:699
|
|
|
|
|
msgid ""
|
|
|
|
|
"A type, introduced in :pep:`593` (``Flexible function and variable "
|
|
|
|
|
"annotations``), to decorate existing types with context-specific metadata "
|
|
|
|
|
"(possibly multiple pieces of it, as ``Annotated`` is variadic). "
|
|
|
|
|
"Specifically, a type ``T`` can be annotated with metadata ``x`` via the "
|
|
|
|
|
"typehint ``Annotated[T, x]``. This metadata can be used for either static "
|
|
|
|
|
"analysis or at runtime. If a library (or tool) encounters a typehint "
|
|
|
|
|
"``Annotated[T, x]`` and has no special logic for metadata ``x``, it should "
|
|
|
|
|
"ignore it and simply treat the type as ``T``. Unlike the ``no_type_check`` "
|
|
|
|
|
"functionality that currently exists in the ``typing`` module which "
|
|
|
|
|
"completely disables typechecking annotations on a function or a class, the "
|
|
|
|
|
"``Annotated`` type allows for both static typechecking of ``T`` (e.g., via "
|
|
|
|
|
"mypy or Pyre, which can safely ignore ``x``) together with runtime access to "
|
|
|
|
|
"``x`` within a specific application."
|
|
|
|
|
msgstr ""
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:713
|
|
|
|
|
msgid ""
|
|
|
|
|
"Ultimately, the responsibility of how to interpret the annotations (if at "
|
|
|
|
|
"all) is the responsibility of the tool or library encountering the "
|
|
|
|
|
"``Annotated`` type. A tool or library encountering an ``Annotated`` type can "
|
|
|
|
|
"scan through the annotations to determine if they are of interest (e.g., "
|
|
|
|
|
"using ``isinstance()``)."
|
|
|
|
|
msgstr ""
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:719
|
|
|
|
|
msgid ""
|
|
|
|
|
"When a tool or a library does not support annotations or encounters an "
|
|
|
|
|
"unknown annotation it should just ignore it and treat annotated type as the "
|
|
|
|
|
"underlying type."
|
|
|
|
|
msgstr ""
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:723
|
|
|
|
|
msgid ""
|
|
|
|
|
"It's up to the tool consuming the annotations to decide whether the client "
|
|
|
|
|
"is allowed to have several annotations on one type and how to merge those "
|
|
|
|
|
"annotations."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:727
|
|
|
|
|
msgid ""
|
|
|
|
|
"Since the ``Annotated`` type allows you to put several annotations of the "
|
|
|
|
|
"same (or different) type(s) on any node, the tools or libraries consuming "
|
|
|
|
|
"those annotations are in charge of dealing with potential duplicates. For "
|
|
|
|
|
"example, if you are doing value range analysis you might allow this::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:736
|
|
|
|
|
msgid ""
|
|
|
|
|
"Passing ``include_extras=True`` to :func:`get_type_hints` lets one access "
|
|
|
|
|
"the extra annotations at runtime."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:739
|
|
|
|
|
msgid "The details of the syntax:"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:741
|
|
|
|
|
msgid "The first argument to ``Annotated`` must be a valid type"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:743
|
|
|
|
|
msgid ""
|
|
|
|
|
"Multiple type annotations are supported (``Annotated`` supports variadic "
|
|
|
|
|
"arguments)::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:748
|
|
|
|
|
msgid ""
|
|
|
|
|
"``Annotated`` must be called with at least two arguments "
|
|
|
|
|
"( ``Annotated[int]`` is not valid)"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:751
|
|
|
|
|
msgid ""
|
|
|
|
|
"The order of the annotations is preserved and matters for equality checks::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:758
|
|
|
|
|
msgid ""
|
|
|
|
|
"Nested ``Annotated`` types are flattened, with metadata ordered starting "
|
|
|
|
|
"with the innermost annotation::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:765
|
|
|
|
|
msgid "Duplicated annotations are not removed::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:771
|
|
|
|
|
msgid "``Annotated`` can be used with nested and generic aliases::"
|
|
|
|
|
msgstr ""
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:782
|
2020-07-20 08:56:42 +00:00
|
|
|
|
#, fuzzy
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgid "Building generic types"
|
|
|
|
|
msgstr "Types génériques définis par l'utilisateur"
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:784
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"These are not used in annotations. They are building blocks for creating "
|
|
|
|
|
"generic types."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:788
|
|
|
|
|
msgid "Abstract base class for generic types."
|
|
|
|
|
msgstr "Classe de base abstraite pour les types génériques."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:790
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"A generic type is typically declared by inheriting from an instantiation of "
|
|
|
|
|
"this class with one or more type variables. For example, a generic mapping "
|
|
|
|
|
"type might be defined as::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"Un type générique est généralement déclaré en héritant d'une instanciation "
|
|
|
|
|
"de cette classe avec une ou plusieurs variables de type. Par exemple, un "
|
|
|
|
|
"type de correspondance générique peut être défini comme suit ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:799
|
|
|
|
|
msgid "This class can then be used as follows::"
|
|
|
|
|
msgstr "Cette classe peut alors être utilisée comme suit ::"
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:812
|
|
|
|
|
msgid "Type variable."
|
|
|
|
|
msgstr "Variables de type."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:814 library/typing.rst:930
|
|
|
|
|
msgid "Usage::"
|
|
|
|
|
msgstr "Utilisation ::"
|
2017-04-02 20:14:06 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:819
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"Type variables exist primarily for the benefit of static type checkers. "
|
|
|
|
|
"They serve as the parameters for generic types as well as for generic "
|
|
|
|
|
"function definitions. See class Generic for more information on generic "
|
|
|
|
|
"types. Generic functions work as follows::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"Les variables de type existent principalement dans l'intérêt des contrôleurs "
|
|
|
|
|
"de type statiques. Elles servent de paramètres pour les types génériques "
|
|
|
|
|
"ainsi que pour les définitions de fonctions génériques. Voir la classe "
|
|
|
|
|
"``Generic`` pour plus d'informations sur les types génériques. Les fonctions "
|
|
|
|
|
"génériques fonctionnent comme suit ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:832
|
|
|
|
|
msgid ""
|
|
|
|
|
"The latter example's signature is essentially the overloading of ``(str, "
|
|
|
|
|
"str) -> str`` and ``(bytes, bytes) -> bytes``. Also note that if the "
|
|
|
|
|
"arguments are instances of some subclass of :class:`str`, the return type is "
|
|
|
|
|
"still plain :class:`str`."
|
|
|
|
|
msgstr ""
|
|
|
|
|
"La signature de ce dernier exemple est essentiellement la surcharge de "
|
|
|
|
|
"``(str, str) -> str`` et ``(bytes, bytes) -> bytes``. Notez également que si "
|
|
|
|
|
"les arguments sont des instances d'une sous-classe de la classe :class:"
|
|
|
|
|
"`str`, le type de retour est toujours la classe :class:`str`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:837
|
2019-01-04 23:29:24 +00:00
|
|
|
|
msgid ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"At runtime, ``isinstance(x, T)`` will raise :exc:`TypeError`. In general, :"
|
|
|
|
|
"func:`isinstance` and :func:`issubclass` should not be used with types."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"Au moment de l'exécution, ``isinstance(x, T)`` va lever :exc:`TypeError`. En "
|
|
|
|
|
"général, :func:`isinstance` et :func:`issubclass` ne devraient pas être "
|
|
|
|
|
"utilisés avec les types."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:840
|
|
|
|
|
msgid ""
|
|
|
|
|
"Type variables may be marked covariant or contravariant by passing "
|
|
|
|
|
"``covariant=True`` or ``contravariant=True``. See :pep:`484` for more "
|
|
|
|
|
"details. By default type variables are invariant. Alternatively, a type "
|
|
|
|
|
"variable may specify an upper bound using ``bound=<type>``. This means that "
|
|
|
|
|
"an actual type substituted (explicitly or implicitly) for the type variable "
|
|
|
|
|
"must be a subclass of the boundary type, see :pep:`484`."
|
|
|
|
|
msgstr ""
|
|
|
|
|
"Les variables de type peuvent être marquées covariantes ou contravariantes "
|
|
|
|
|
"en passant ``covariant=True`` ou ``contravariant=True``. Voir la :pep:`484` "
|
|
|
|
|
"pour plus de détails. Par défaut, les variables de type sont invariantes. "
|
|
|
|
|
"Sinon, une variable de type peut spécifier une limite supérieure en "
|
|
|
|
|
"utilisant ``bound=<type>``. Cela signifie qu'un type réel substitué "
|
|
|
|
|
"(explicitement ou implicitement) à la variable type doit être une sous-"
|
|
|
|
|
"classe du type frontière (*boundary* en anglais), voir la :pep:`484`."
|
2017-04-02 20:14:06 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:850
|
|
|
|
|
msgid ""
|
|
|
|
|
"``AnyStr`` is a type variable defined as ``AnyStr = TypeVar('AnyStr', str, "
|
|
|
|
|
"bytes)``."
|
|
|
|
|
msgstr ""
|
|
|
|
|
"``AnyStr`` est une variable de type définie comme ``AnyStr = "
|
|
|
|
|
"TypeVar('AnyStr', str, bytes)``."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:853
|
|
|
|
|
msgid ""
|
|
|
|
|
"It is meant to be used for functions that may accept any kind of string "
|
|
|
|
|
"without allowing different kinds of strings to mix. For example::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
"Cela est destiné à être utilisé pour des fonctions qui peuvent accepter "
|
|
|
|
|
"n'importe quel type de chaîne de caractères sans permettre à différents "
|
|
|
|
|
"types de chaînes de caractères de se mélanger. Par exemple ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:865
|
|
|
|
|
msgid ""
|
|
|
|
|
"Base class for protocol classes. Protocol classes are defined like this::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
"Classe de base pour les classes de protocole. Les classes de protocole sont "
|
|
|
|
|
"définies comme suit ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:871
|
|
|
|
|
msgid ""
|
|
|
|
|
"Such classes are primarily used with static type checkers that recognize "
|
|
|
|
|
"structural subtyping (static duck-typing), for example::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
"Ces classes sont principalement utilisées avec les vérificateurs statiques "
|
|
|
|
|
"de type qui reconnaissent les sous-types structurels (typage canard "
|
|
|
|
|
"statique), par exemple ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:883
|
|
|
|
|
msgid ""
|
|
|
|
|
"See :pep:`544` for details. Protocol classes decorated with :func:"
|
|
|
|
|
"`runtime_checkable` (described later) act as simple-minded runtime protocols "
|
|
|
|
|
"that check only the presence of given attributes, ignoring their type "
|
|
|
|
|
"signatures."
|
|
|
|
|
msgstr ""
|
|
|
|
|
"Voir la :pep:`544` pour plus de détails. Les classes de protocole décorées "
|
|
|
|
|
"avec :func:`runtime_checkable` (décrite plus loin) agissent comme des "
|
|
|
|
|
"protocoles d'exécution simples qui ne vérifient que la présence d'attributs "
|
|
|
|
|
"donnés, ignorant leurs signatures de type."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:888
|
|
|
|
|
msgid "Protocol classes can be generic, for example::"
|
|
|
|
|
msgstr "Les classes de protocole peuvent être génériques, par exemple ::"
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:898
|
|
|
|
|
msgid "Mark a protocol class as a runtime protocol."
|
|
|
|
|
msgstr "Marquez une classe de protocole comme protocole d'exécution."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:900
|
2017-04-02 20:14:06 +00:00
|
|
|
|
msgid ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"Such a protocol can be used with :func:`isinstance` and :func:`issubclass`. "
|
|
|
|
|
"This raises :exc:`TypeError` when applied to a non-protocol class. This "
|
|
|
|
|
"allows a simple-minded structural check, very similar to \"one trick ponies"
|
|
|
|
|
"\" in :mod:`collections.abc` such as :class:`Iterable`. For example::"
|
2017-04-02 20:14:06 +00:00
|
|
|
|
msgstr ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"Un tel protocole peut être utilisé avec :func:`isinstance` et :func:"
|
|
|
|
|
"`issubclass`. Cela lève :exc:`TypeError` lorsqu'il est appliqué à une classe "
|
|
|
|
|
"non protocole. Cela permet un contrôle structurel compréhensible, très "
|
|
|
|
|
"similaire aux « classes qui ne savent faire qu'une chose » présentes dans :"
|
|
|
|
|
"mod:`collections.abc` tel que :class:`Iterable`. Par exemple ::"
|
2017-04-02 20:14:06 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:913
|
|
|
|
|
msgid ""
|
|
|
|
|
":func:`runtime_checkable` will check only the presence of the required "
|
|
|
|
|
"methods, not their type signatures! For example, :class:`builtins.complex "
|
|
|
|
|
"<complex>` implements :func:`__float__`, therefore it passes an :func:"
|
|
|
|
|
"`issubclass` check against :class:`SupportsFloat`. However, the ``complex."
|
|
|
|
|
"__float__`` method exists only to raise a :class:`TypeError` with a more "
|
|
|
|
|
"informative message."
|
|
|
|
|
msgstr ""
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:922
|
|
|
|
|
msgid "Other special directives"
|
|
|
|
|
msgstr ""
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:924
|
|
|
|
|
msgid ""
|
|
|
|
|
"These are not used in annotations. They are building blocks for declaring "
|
|
|
|
|
"types."
|
|
|
|
|
msgstr ""
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:928
|
|
|
|
|
msgid "Typed version of :func:`collections.namedtuple`."
|
|
|
|
|
msgstr "Version typée de :func:`collections.namedtuple`."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:936
|
|
|
|
|
msgid "This is equivalent to::"
|
|
|
|
|
msgstr "Ce qui est équivalent à ::"
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:940
|
|
|
|
|
msgid ""
|
|
|
|
|
"To give a field a default value, you can assign to it in the class body::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
"Pour assigner une valeur par défaut à un champ, vous pouvez lui donner dans "
|
|
|
|
|
"le corps de classe ::"
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:949
|
|
|
|
|
msgid ""
|
|
|
|
|
"Fields with a default value must come after any fields without a default."
|
|
|
|
|
msgstr ""
|
|
|
|
|
"Les champs avec une valeur par défaut doivent venir après tous les champs "
|
|
|
|
|
"sans valeur par défaut."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:951
|
|
|
|
|
msgid ""
|
|
|
|
|
"The resulting class has an extra attribute ``__annotations__`` giving a dict "
|
|
|
|
|
"that maps the field names to the field types. (The field names are in the "
|
|
|
|
|
"``_fields`` attribute and the default values are in the ``_field_defaults`` "
|
|
|
|
|
"attribute both of which are part of the namedtuple API.)"
|
|
|
|
|
msgstr ""
|
|
|
|
|
"La classe résultante a un attribut supplémentaire ``__annotations__`` "
|
|
|
|
|
"donnant un dictionnaire qui associe les noms des champs aux types de champs. "
|
|
|
|
|
"(Les noms des champs sont dans l'attribut ``_fields`` et les valeurs par "
|
|
|
|
|
"défaut sont dans l'attribut ``_field_defaults`` qui font partie de l'API "
|
|
|
|
|
"*namedtuple*.)"
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:957
|
|
|
|
|
msgid "``NamedTuple`` subclasses can also have docstrings and methods::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
"Les sous-classes de ``NamedTuple`` peuvent aussi avoir des *docstrings* et "
|
|
|
|
|
"des méthodes ::"
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:967
|
|
|
|
|
msgid "Backward-compatible usage::"
|
|
|
|
|
msgstr "Utilisation rétrocompatible ::"
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:971
|
|
|
|
|
msgid "Added support for :pep:`526` variable annotation syntax."
|
|
|
|
|
msgstr ""
|
|
|
|
|
"Ajout de la gestion de la syntaxe d'annotation variable de la :pep:`526`."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:974
|
|
|
|
|
msgid "Added support for default values, methods, and docstrings."
|
|
|
|
|
msgstr ""
|
|
|
|
|
"Ajout de la prise en charge des valeurs par défaut, des méthodes et des "
|
|
|
|
|
"chaînes de caractères *docstrings*."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:977
|
|
|
|
|
msgid ""
|
|
|
|
|
"The ``_field_types`` and ``__annotations__`` attributes are now regular "
|
|
|
|
|
"dictionaries instead of instances of ``OrderedDict``."
|
|
|
|
|
msgstr ""
|
|
|
|
|
"Les attributs ``_field_types`` et ``__annotations__`` sont maintenant des "
|
|
|
|
|
"dictionnaires standards au lieu d'instances de ``OrderedDict``."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:981
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid ""
|
|
|
|
|
"Removed the ``_field_types`` attribute in favor of the more standard "
|
|
|
|
|
"``__annotations__`` attribute which has the same information."
|
|
|
|
|
msgstr ""
|
|
|
|
|
"rend l'attribut ``_field_types`` obsolète en faveur de l'attribut plus "
|
|
|
|
|
"standard ``__annotations__`` qui a la même information."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:987
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid ""
|
|
|
|
|
"A helper function to indicate a distinct type to a typechecker, see :ref:"
|
|
|
|
|
"`distinct`. At runtime it returns a function that returns its argument. "
|
|
|
|
|
"Usage::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
"Une fonction pour faciliter l'indication d'un type distinct à un "
|
|
|
|
|
"vérificateur de type, voir :ref:`distinct`. Lors de l'exécution, elle "
|
|
|
|
|
"renvoie une fonction qui renvoie son argument. Utilisation ::"
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:998
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid ""
|
|
|
|
|
"Special construct to add type hints to a dictionary. At runtime it is a "
|
|
|
|
|
"plain :class:`dict`."
|
|
|
|
|
msgstr ""
|
|
|
|
|
"Un simple espace de nommage typé. À l'exécution, c'est l'équivalent d'un "
|
|
|
|
|
"simple :class:`dict`."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:1001
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid ""
|
|
|
|
|
"``TypedDict`` declares a dictionary type that expects all of its instances "
|
|
|
|
|
"to have a certain set of keys, where each key is associated with a value of "
|
|
|
|
|
"a consistent type. This expectation is not checked at runtime but is only "
|
|
|
|
|
"enforced by type checkers. Usage::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
"``TypedDict`` crée un type de dictionnaire qui s'attend à ce que toutes ses "
|
|
|
|
|
"instances aient un certain jeu de clés, où chaque clé est associée à une "
|
|
|
|
|
"valeur d'un type cohérent. Cette vérification n'est pas faite au moment de "
|
|
|
|
|
"l'exécution mais n'est appliquée que par les vérificateurs de type. "
|
|
|
|
|
"Utilisation ::"
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:1017
|
|
|
|
|
msgid ""
|
|
|
|
|
"The type info for introspection can be accessed via ``Point2D."
|
|
|
|
|
"__annotations__`` and ``Point2D.__total__``. To allow using this feature "
|
|
|
|
|
"with older versions of Python that do not support :pep:`526`, ``TypedDict`` "
|
|
|
|
|
"supports two additional equivalent syntactic forms::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
"Les informations de type pour l'introspection sont accessibles via ``Point2D."
|
|
|
|
|
"__annotations__`` et ``Point2D.__total__``. Pour permettre l'utilisation de "
|
|
|
|
|
"cette fonctionnalité avec les anciennes versions de Python qui ne prennent "
|
|
|
|
|
"pas en compte la :pep:`526`, ``TypedDict`` gère deux formes syntaxiques "
|
|
|
|
|
"équivalentes supplémentaires ::"
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:1025
|
|
|
|
|
msgid ""
|
|
|
|
|
"By default, all keys must be present in a TypedDict. It is possible to "
|
|
|
|
|
"override this by specifying totality. Usage::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:1033
|
|
|
|
|
msgid ""
|
|
|
|
|
"This means that a point2D TypedDict can have any of the keys omitted. A type "
|
|
|
|
|
"checker is only expected to support a literal False or True as the value of "
|
|
|
|
|
"the total argument. True is the default, and makes all items defined in the "
|
|
|
|
|
"class body be required."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:1038
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid ""
|
|
|
|
|
"See :pep:`589` for more examples and detailed rules of using ``TypedDict``."
|
|
|
|
|
msgstr ""
|
|
|
|
|
"Voir la :pep:`589` pour plus d'exemples et de règles détaillées "
|
|
|
|
|
"d'utilisation de ``TypedDict`` avec les vérificateurs de type."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:1043
|
|
|
|
|
msgid "Generic concrete collections"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:1046
|
|
|
|
|
msgid "Corresponding to built-in types"
|
2018-06-10 09:32:30 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1050
|
2018-06-10 09:32:30 +00:00
|
|
|
|
msgid ""
|
2019-01-04 23:29:24 +00:00
|
|
|
|
"A generic version of :class:`dict`. Useful for annotating return types. To "
|
|
|
|
|
"annotate arguments it is preferred to use an abstract collection type such "
|
|
|
|
|
"as :class:`Mapping`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
2020-05-03 15:12:15 +00:00
|
|
|
|
"Une version générique de :class:`dict`. Utile pour annoter les types de "
|
|
|
|
|
"retour. Pour annoter les arguments, il est préférable d'utiliser un type de "
|
|
|
|
|
"collection abstraite tel que :class:`Mapping`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1054
|
2019-01-04 23:29:24 +00:00
|
|
|
|
msgid "This type can be used as follows::"
|
2020-05-03 15:12:15 +00:00
|
|
|
|
msgstr "Ce type peut être utilisé comme suit ::"
|
2019-01-04 23:29:24 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1059
|
|
|
|
|
msgid ":class:`builtins.dict <dict>` now supports ``[]``. See :pep:`585`."
|
|
|
|
|
msgstr ""
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1064
|
|
|
|
|
msgid ""
|
|
|
|
|
"Generic version of :class:`list`. Useful for annotating return types. To "
|
|
|
|
|
"annotate arguments it is preferred to use an abstract collection type such "
|
|
|
|
|
"as :class:`Sequence` or :class:`Iterable`."
|
|
|
|
|
msgstr ""
|
|
|
|
|
"Version générique de :class:`list`. Utile pour annoter les types de retour. "
|
|
|
|
|
"Pour annoter les arguments, il est préférable d'utiliser un type de "
|
|
|
|
|
"collection abstraite tel que :class:`Sequence` ou :class:`Iterable`."
|
2017-05-27 17:46:38 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1069
|
|
|
|
|
msgid "This type may be used as follows::"
|
|
|
|
|
msgstr "Ce type peut être utilisé comme suit ::"
|
2017-05-27 17:46:38 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1079
|
|
|
|
|
msgid ":class:`builtins.list <list>` now supports ``[]``. See :pep:`585`."
|
|
|
|
|
msgstr ""
|
2018-12-24 13:20:55 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1084
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"A generic version of :class:`builtins.set <set>`. Useful for annotating "
|
|
|
|
|
"return types. To annotate arguments it is preferred to use an abstract "
|
|
|
|
|
"collection type such as :class:`AbstractSet`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"Une version générique de :class:`builtins.set <set>`. Utile pour annoter les "
|
|
|
|
|
"types de retour. Pour annoter les arguments, il est préférable d'utiliser un "
|
|
|
|
|
"type de collection abstraite tel que :class:`AbstractSet`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1088
|
|
|
|
|
msgid ":class:`builtins.set <set>` now supports ``[]``. See :pep:`585`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1093
|
|
|
|
|
msgid "A generic version of :class:`builtins.frozenset <frozenset>`."
|
|
|
|
|
msgstr "Une version générique de :class:`builtins.frozenset <frozenset>`."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:1095
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
":class:`builtins.frozenset <frozenset>` now supports ``[]``. See :pep:`585`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1098
|
|
|
|
|
msgid ":data:`Tuple` is a special form."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1101
|
|
|
|
|
msgid "Corresponding to types in :mod:`collections`"
|
2017-04-02 20:14:06 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1105
|
|
|
|
|
msgid "A generic version of :class:`collections.defaultdict`."
|
|
|
|
|
msgstr "Une version générique de :class:`collections.defaultdict`."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:1109
|
|
|
|
|
msgid ":class:`collections.defaultdict` now supports ``[]``. See :pep:`585`."
|
2017-04-02 20:14:06 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1114
|
|
|
|
|
msgid "A generic version of :class:`collections.OrderedDict`."
|
|
|
|
|
msgstr "Une version générique de :class:`collections.OrderedDict`."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:1118
|
|
|
|
|
msgid ":class:`collections.OrderedDict` now supports ``[]``. See :pep:`585`."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:1123
|
|
|
|
|
msgid "A generic version of :class:`collections.ChainMap`."
|
|
|
|
|
msgstr "Une version générique de :class:`collections.ChainMap`."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:1128
|
|
|
|
|
msgid ":class:`collections.ChainMap` now supports ``[]``. See :pep:`585`."
|
2017-04-02 20:14:06 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1133
|
|
|
|
|
msgid "A generic version of :class:`collections.Counter`."
|
|
|
|
|
msgstr "Une version générique de :class:`collections.Counter`."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:1138
|
|
|
|
|
msgid ":class:`collections.Counter` now supports ``[]``. See :pep:`585`."
|
2017-04-02 20:14:06 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1143
|
|
|
|
|
msgid "A generic version of :class:`collections.deque`."
|
|
|
|
|
msgstr "Une version générique de :class:`collections.deque`."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:1148
|
|
|
|
|
msgid ":class:`collections.deque` now supports ``[]``. See :pep:`585`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1152
|
|
|
|
|
msgid "Other concrete types"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1158
|
|
|
|
|
#, fuzzy
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
2018-11-29 15:13:39 +00:00
|
|
|
|
"Generic type ``IO[AnyStr]`` and its subclasses ``TextIO(IO[str])`` and "
|
|
|
|
|
"``BinaryIO(IO[bytes])`` represent the types of I/O streams such as returned "
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"by :func:`open`. These types are also in the ``typing.io`` namespace."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
2020-05-03 15:12:15 +00:00
|
|
|
|
"Le type générique ``IO[AnyStr]`` et ses sous-classes ``TextIO(IO[str])`` et "
|
|
|
|
|
"``BinaryIO(IO[bytes])`` représentent les types de flux d'entrées-sorties "
|
|
|
|
|
"tels que renvoyés par :func:`open`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1166
|
|
|
|
|
#, fuzzy
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
2018-11-29 15:13:39 +00:00
|
|
|
|
"These type aliases correspond to the return types from :func:`re.compile` "
|
|
|
|
|
"and :func:`re.match`. These types (and the corresponding functions) are "
|
|
|
|
|
"generic in ``AnyStr`` and can be made specific by writing ``Pattern[str]``, "
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"``Pattern[bytes]``, ``Match[str]``, or ``Match[bytes]``. These types are "
|
|
|
|
|
"also in the ``typing.re`` namespace."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
2020-05-03 15:12:15 +00:00
|
|
|
|
"Ces alias de type correspondent aux types de retour de :func:`re.compile` "
|
|
|
|
|
"et :func:`re.match`. Ces types (et les fonctions correspondantes) sont "
|
|
|
|
|
"génériques dans ``AnyStr`` et peuvent être rendus spécifiques en écrivant "
|
|
|
|
|
"``Pattern[str]``, ``Pattern[bytes]``, ``Match[str]`` ou ``Match[bytes]``."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1173
|
2017-04-02 20:14:06 +00:00
|
|
|
|
msgid ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"Classes ``Pattern`` and ``Match`` from :mod:`re` now support ``[]``. See :"
|
|
|
|
|
"pep:`585`."
|
2017-04-02 20:14:06 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1178
|
2017-04-02 20:14:06 +00:00
|
|
|
|
msgid ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"``Text`` is an alias for ``str``. It is provided to supply a forward "
|
|
|
|
|
"compatible path for Python 2 code: in Python 2, ``Text`` is an alias for "
|
|
|
|
|
"``unicode``."
|
2017-04-02 20:14:06 +00:00
|
|
|
|
msgstr ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"``Text`` est un alias pour ``str``. Il est fourni pour obtenir une "
|
|
|
|
|
"compatibilité ascendante du code Python 2 : en Python 2, ``Text`` est un "
|
|
|
|
|
"alias pour ``unicode``."
|
2017-04-02 20:14:06 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1182
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"Use ``Text`` to indicate that a value must contain a unicode string in a "
|
|
|
|
|
"manner that is compatible with both Python 2 and Python 3::"
|
2017-05-27 17:46:38 +00:00
|
|
|
|
msgstr ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"Utilisez ``Text`` pour indiquer qu'une valeur doit contenir une chaîne "
|
|
|
|
|
"Unicode d'une manière compatible avec Python 2 et Python 3 ::"
|
2017-05-27 17:46:38 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1191
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "Abstract Base Classes"
|
|
|
|
|
msgstr "Classe de base abstraite pour les types génériques."
|
2017-04-02 20:14:06 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1194
|
|
|
|
|
msgid "Corresponding to collections in :mod:`collections.abc`"
|
2017-04-02 20:14:06 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1198
|
|
|
|
|
msgid "A generic version of :class:`collections.abc.Set`."
|
|
|
|
|
msgstr "Une version générique de :class:`collections.abc.Set`."
|
2017-04-02 20:14:06 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1200
|
|
|
|
|
msgid ":class:`collections.abc.Set` now supports ``[]``. See :pep:`585`."
|
2019-09-04 09:35:23 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1205
|
|
|
|
|
msgid "A generic version of :class:`collections.abc.ByteString`."
|
|
|
|
|
msgstr "Une version générique de :class:`collections.abc.ByteString`."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:1207
|
2020-07-20 08:56:42 +00:00
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"This type represents the types :class:`bytes`, :class:`bytearray`, and :"
|
|
|
|
|
"class:`memoryview` of byte sequences."
|
2020-07-20 08:56:42 +00:00
|
|
|
|
msgstr ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"Ce type représente les types :class:`bytes`, :class:`bytearray` et :class:"
|
|
|
|
|
"`memoryview`."
|
2020-07-20 08:56:42 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1210
|
2019-09-04 09:35:23 +00:00
|
|
|
|
msgid ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"As a shorthand for this type, :class:`bytes` can be used to annotate "
|
|
|
|
|
"arguments of any of the types mentioned above."
|
2019-09-04 09:35:23 +00:00
|
|
|
|
msgstr ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"Comme abréviation pour ce type, :class:`bytes` peut être utilisé pour "
|
|
|
|
|
"annoter des arguments de n'importe quel type mentionné ci-dessus."
|
2019-09-04 09:35:23 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1213
|
2019-09-04 09:35:23 +00:00
|
|
|
|
msgid ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
":class:`collections.abc.ByteString` now supports ``[]``. See :pep:`585`."
|
2019-09-04 09:35:23 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1218
|
|
|
|
|
msgid "A generic version of :class:`collections.abc.Collection`"
|
|
|
|
|
msgstr "Une version générique de :class:`collections.abc.Collection`"
|
2019-09-04 09:35:23 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1222
|
2019-09-04 09:35:23 +00:00
|
|
|
|
msgid ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
":class:`collections.abc.Collection` now supports ``[]``. See :pep:`585`."
|
2020-05-24 14:31:50 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1227
|
|
|
|
|
msgid "A generic version of :class:`collections.abc.Container`."
|
|
|
|
|
msgstr "Une version générique de :class:`collections.abc.Container`."
|
2020-05-24 14:31:50 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1229
|
|
|
|
|
msgid ":class:`collections.abc.Container` now supports ``[]``. See :pep:`585`."
|
2019-09-04 09:35:23 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1234
|
|
|
|
|
msgid "A generic version of :class:`collections.abc.ItemsView`."
|
|
|
|
|
msgstr "Une version générique de :class:`collections.abc.ItemsView`."
|
2019-06-19 20:35:23 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1236
|
|
|
|
|
msgid ":class:`collections.abc.ItemsView` now supports ``[]``. See :pep:`585`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1241
|
|
|
|
|
msgid "A generic version of :class:`collections.abc.KeysView`."
|
|
|
|
|
msgstr "Une version générique de :class:`collections.abc.KeysView`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1243
|
|
|
|
|
msgid ":class:`collections.abc.KeysView` now supports ``[]``. See :pep:`585`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1248
|
2017-04-02 20:14:06 +00:00
|
|
|
|
msgid ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"A generic version of :class:`collections.abc.Mapping`. This type can be used "
|
|
|
|
|
"as follows::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"Une version générique de :class:`collections.abc.Mapping`. Ce type peut être "
|
|
|
|
|
"utilisé comme suit ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1254
|
|
|
|
|
msgid ":class:`collections.abc.Mapping` now supports ``[]``. See :pep:`585`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1259
|
|
|
|
|
msgid "A generic version of :class:`collections.abc.MappingView`."
|
|
|
|
|
msgstr "Une version générique de :class:`collections.abc.MappingView`."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:1261
|
2020-07-20 08:56:42 +00:00
|
|
|
|
msgid ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
":class:`collections.abc.MappingView` now supports ``[]``. See :pep:`585`."
|
2020-07-20 08:56:42 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1266
|
|
|
|
|
msgid "A generic version of :class:`collections.abc.MutableMapping`."
|
|
|
|
|
msgstr "Une version générique de :class:`collections.abc.MutableMapping`."
|
2020-07-20 08:56:42 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1268
|
|
|
|
|
msgid ""
|
|
|
|
|
":class:`collections.abc.MutableMapping` now supports ``[]``. See :pep:`585`."
|
2019-09-04 09:35:23 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1273
|
|
|
|
|
msgid "A generic version of :class:`collections.abc.MutableSequence`."
|
|
|
|
|
msgstr "Une version générique de :class:`collections.abc.MutableSequence`."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:1275
|
2019-09-04 09:35:23 +00:00
|
|
|
|
msgid ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
":class:`collections.abc.MutableSequence` now supports ``[]``. See :pep:`585`."
|
2019-09-04 09:35:23 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1280
|
|
|
|
|
msgid "A generic version of :class:`collections.abc.MutableSet`."
|
|
|
|
|
msgstr "Une version générique de :class:`collections.abc.MutableSet`."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:1282
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
":class:`collections.abc.MutableSet` now supports ``[]``. See :pep:`585`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1287
|
|
|
|
|
msgid "A generic version of :class:`collections.abc.Sequence`."
|
|
|
|
|
msgstr "Une version générique de :class:`collections.abc.Sequence`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1289
|
|
|
|
|
msgid ":class:`collections.abc.Sequence` now supports ``[]``. See :pep:`585`."
|
2019-09-04 09:35:23 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1294
|
|
|
|
|
msgid "A generic version of :class:`collections.abc.ValuesView`."
|
|
|
|
|
msgstr "Une version générique de :class:`collections.abc.ValuesView`."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:1296
|
2019-09-04 09:35:23 +00:00
|
|
|
|
msgid ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
":class:`collections.abc.ValuesView` now supports ``[]``. See :pep:`585`."
|
2019-09-04 09:35:23 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1300
|
|
|
|
|
msgid "Corresponding to other types in :mod:`collections.abc`"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1304
|
|
|
|
|
msgid "A generic version of :class:`collections.abc.Iterable`."
|
|
|
|
|
msgstr "Une version générique de :class:`collections.abc.Iterable`."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:1306
|
|
|
|
|
msgid ":class:`collections.abc.Iterable` now supports ``[]``. See :pep:`585`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1311
|
|
|
|
|
msgid "A generic version of :class:`collections.abc.Iterator`."
|
|
|
|
|
msgstr "Une version générique de :class:`collections.abc.Iterator`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1313
|
|
|
|
|
msgid ":class:`collections.abc.Iterator` now supports ``[]``. See :pep:`585`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1318
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"A generator can be annotated by the generic type ``Generator[YieldType, "
|
|
|
|
|
"SendType, ReturnType]``. For example::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"Un générateur peut être annoté par le type générique ``Generator[YieldType, "
|
|
|
|
|
"SendType, ReturnType]``. Par exemple ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1327
|
|
|
|
|
msgid ""
|
|
|
|
|
"Note that unlike many other generics in the typing module, the ``SendType`` "
|
|
|
|
|
"of :class:`Generator` behaves contravariantly, not covariantly or "
|
|
|
|
|
"invariantly."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"Notez que contrairement à beaucoup d'autres génériques dans le module "
|
|
|
|
|
"*typing*, le ``SendType`` de :class:`Generator` se comporte de manière "
|
|
|
|
|
"contravariante, pas de manière covariante ou invariante."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1331
|
2019-05-23 16:59:19 +00:00
|
|
|
|
msgid ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"If your generator will only yield values, set the ``SendType`` and "
|
|
|
|
|
"``ReturnType`` to ``None``::"
|
2019-05-23 16:59:19 +00:00
|
|
|
|
msgstr ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"Si votre générateur ne donne que des valeurs, réglez les paramètres "
|
|
|
|
|
"``SendType`` et ``ReturnType`` sur ``None`` ::"
|
2019-05-23 16:59:19 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1339
|
2019-05-23 16:59:19 +00:00
|
|
|
|
msgid ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"Alternatively, annotate your generator as having a return type of either "
|
|
|
|
|
"``Iterable[YieldType]`` or ``Iterator[YieldType]``::"
|
2019-05-23 16:59:19 +00:00
|
|
|
|
msgstr ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"Alternativement, annotez votre générateur comme ayant un type de retour soit "
|
|
|
|
|
"``Iterable[YieldType]`` ou ``Iterator[YieldType]`` ::"
|
2019-05-23 16:59:19 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1347
|
|
|
|
|
msgid ":class:`collections.abc.Generator` now supports ``[]``. See :pep:`585`."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:1352
|
|
|
|
|
msgid "An alias to :class:`collections.abc.Hashable`"
|
|
|
|
|
msgstr "Un alias pour :class:`collections.abc.Hashable`"
|
2019-09-04 09:35:23 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1356
|
|
|
|
|
msgid "A generic version of :class:`collections.abc.Reversible`."
|
|
|
|
|
msgstr "Une version générique de :class:`collections.abc.Reversible`."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:1358
|
2019-09-04 09:35:23 +00:00
|
|
|
|
msgid ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
":class:`collections.abc.Reversible` now supports ``[]``. See :pep:`585`."
|
2019-09-04 09:35:23 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1363
|
|
|
|
|
msgid "An alias to :class:`collections.abc.Sized`"
|
|
|
|
|
msgstr "Un alias pour :class:`collections.abc.Sized`"
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:1366
|
|
|
|
|
msgid "Asynchronous programming"
|
2019-09-04 09:35:23 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1370
|
|
|
|
|
msgid ""
|
|
|
|
|
"A generic version of :class:`collections.abc.Coroutine`. The variance and "
|
|
|
|
|
"order of type variables correspond to those of :class:`Generator`, for "
|
|
|
|
|
"example::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
"Une version générique de :class:`collections.abc.Coroutine`. La variance et "
|
|
|
|
|
"l'ordre des variables de type correspondent à ceux de la classe :class:"
|
|
|
|
|
"`Generator`, par exemple ::"
|
2019-05-23 16:59:19 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1383
|
|
|
|
|
msgid ":class:`collections.abc.Coroutine` now supports ``[]``. See :pep:`585`."
|
|
|
|
|
msgstr ""
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1388
|
|
|
|
|
msgid ""
|
|
|
|
|
"An async generator can be annotated by the generic type "
|
|
|
|
|
"``AsyncGenerator[YieldType, SendType]``. For example::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
"Un générateur asynchrone peut être annoté par le type générique "
|
|
|
|
|
"``AsyncGenerator[YieldType, SendType]``. Par exemple ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1397
|
|
|
|
|
msgid ""
|
|
|
|
|
"Unlike normal generators, async generators cannot return a value, so there "
|
|
|
|
|
"is no ``ReturnType`` type parameter. As with :class:`Generator`, the "
|
|
|
|
|
"``SendType`` behaves contravariantly."
|
|
|
|
|
msgstr ""
|
|
|
|
|
"Contrairement aux générateurs normaux, les générateurs asynchrones ne "
|
|
|
|
|
"peuvent pas renvoyer une valeur, il n'y a donc pas de paramètre de type "
|
|
|
|
|
"``ReturnType``. Comme avec :class:`Generator`, le ``SendType`` se comporte "
|
|
|
|
|
"de manière contravariante."
|
2018-06-10 09:32:30 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1401
|
|
|
|
|
msgid ""
|
|
|
|
|
"If your generator will only yield values, set the ``SendType`` to ``None``::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
"Si votre générateur ne donne que des valeurs, réglez le paramètre "
|
|
|
|
|
"``SendType`` sur ``None`` ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1409
|
|
|
|
|
msgid ""
|
|
|
|
|
"Alternatively, annotate your generator as having a return type of either "
|
|
|
|
|
"``AsyncIterable[YieldType]`` or ``AsyncIterator[YieldType]``::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"Alternativement, annotez votre générateur comme ayant un type de retour soit "
|
|
|
|
|
"``AsyncIterable[YieldType]`` ou ``AsyncIterator[YieldType]`` ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1419
|
|
|
|
|
msgid ""
|
|
|
|
|
":class:`collections.abc.AsyncGenerator` now supports ``[]``. See :pep:`585`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1424
|
|
|
|
|
msgid "A generic version of :class:`collections.abc.AsyncIterable`."
|
|
|
|
|
msgstr "Une version générique de :class:`collections.abc.AsyncIterable`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1428
|
|
|
|
|
msgid ""
|
|
|
|
|
":class:`collections.abc.AsyncIterable` now supports ``[]``. See :pep:`585`."
|
|
|
|
|
msgstr ""
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1433
|
|
|
|
|
msgid "A generic version of :class:`collections.abc.AsyncIterator`."
|
|
|
|
|
msgstr "Une version générique de :class:`collections.abc.AsyncIterator`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1437
|
|
|
|
|
msgid ""
|
|
|
|
|
":class:`collections.abc.AsyncIterator` now supports ``[]``. See :pep:`585`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1442
|
|
|
|
|
msgid "A generic version of :class:`collections.abc.Awaitable`."
|
|
|
|
|
msgstr "Une version générique de :class:`collections.abc.Awaitable`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1446
|
|
|
|
|
msgid ":class:`collections.abc.Awaitable` now supports ``[]``. See :pep:`585`."
|
|
|
|
|
msgstr ""
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1451
|
|
|
|
|
msgid "Context manager types"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1455
|
|
|
|
|
msgid "A generic version of :class:`contextlib.AbstractContextManager`."
|
|
|
|
|
msgstr "Une version générique de :class:`contextlib.AbstractContextManager`."
|
2018-06-28 13:32:56 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1460
|
|
|
|
|
msgid ""
|
|
|
|
|
":class:`collections.contextlib.AbstractContextManager` now supports ``[]``. "
|
|
|
|
|
"See :pep:`585`."
|
|
|
|
|
msgstr ""
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1465
|
|
|
|
|
msgid "A generic version of :class:`contextlib.AbstractAsyncContextManager`."
|
|
|
|
|
msgstr ""
|
|
|
|
|
"Une version générique de :class:`contextlib.AbstractAsyncContextManager`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1470
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
":class:`collections.contextlib.AbstractAsyncContextManager` now supports "
|
|
|
|
|
"``[]``. See :pep:`585`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1474
|
|
|
|
|
msgid "Protocols"
|
2018-09-15 19:51:48 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1476
|
|
|
|
|
msgid "These protocols are decorated with :func:`runtime_checkable`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1480
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"An ABC with one abstract method ``__abs__`` that is covariant in its return "
|
|
|
|
|
"type."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"Une ABC avec une méthode abstraite ``__abs__`` qui est covariante dans son "
|
|
|
|
|
"type de retour."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:1485
|
|
|
|
|
msgid "An ABC with one abstract method ``__bytes__``."
|
|
|
|
|
msgstr "Une ABC avec une méthode abstraite ``__bytes__``."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:1489
|
|
|
|
|
msgid "An ABC with one abstract method ``__complex__``."
|
|
|
|
|
msgstr "Une ABC avec une méthode abstraite ``__complex__``."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:1493
|
|
|
|
|
msgid "An ABC with one abstract method ``__float__``."
|
|
|
|
|
msgstr "Une ABC avec une méthode abstraite ``__float__``."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:1497
|
|
|
|
|
msgid "An ABC with one abstract method ``__index__``."
|
|
|
|
|
msgstr "Une ABC avec une méthode abstraite ``__index__``."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:1503
|
|
|
|
|
msgid "An ABC with one abstract method ``__int__``."
|
|
|
|
|
msgstr "Une ABC avec une méthode abstraite ``__int__``."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1507
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"An ABC with one abstract method ``__round__`` that is covariant in its "
|
|
|
|
|
"return type."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"Une ABC avec une méthode abstraite ``__round__`` qui est covariante dans son "
|
|
|
|
|
"type de retour."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1511
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "Functions and decorators"
|
|
|
|
|
msgstr "Classes, fonctions et décorateurs"
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:1515
|
|
|
|
|
msgid "Cast a value to a type."
|
|
|
|
|
msgstr "Convertit une valeur en un type."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1517
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"This returns the value unchanged. To the type checker this signals that the "
|
|
|
|
|
"return value has the designated type, but at runtime we intentionally don't "
|
|
|
|
|
"check anything (we want this to be as fast as possible)."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"Ceci renvoie la valeur inchangée. Pour le vérificateur de type, cela "
|
|
|
|
|
"signifie que la valeur de retour a le type désigné mais, à l'exécution, "
|
|
|
|
|
"intentionnellement, rien n'est vérifié (afin que cela soit aussi rapide que "
|
|
|
|
|
"possible)."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1524
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"The ``@overload`` decorator allows describing functions and methods that "
|
|
|
|
|
"support multiple different combinations of argument types. A series of "
|
|
|
|
|
"``@overload``-decorated definitions must be followed by exactly one non-"
|
|
|
|
|
"``@overload``-decorated definition (for the same function/method). The "
|
|
|
|
|
"``@overload``-decorated definitions are for the benefit of the type checker "
|
|
|
|
|
"only, since they will be overwritten by the non-``@overload``-decorated "
|
|
|
|
|
"definition, while the latter is used at runtime but should be ignored by a "
|
|
|
|
|
"type checker. At runtime, calling a ``@overload``-decorated function "
|
|
|
|
|
"directly will raise :exc:`NotImplementedError`. An example of overload that "
|
|
|
|
|
"gives a more precise type than can be expressed using a union or a type "
|
|
|
|
|
"variable::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"Le décorateur ``@overload``` permet de décrire des fonctions et des méthodes "
|
|
|
|
|
"qui acceptent plusieurs combinaisons différentes de types d'arguments. Une "
|
|
|
|
|
"série de définitions décorées avec ``overload`` doit être suivie d'une seule "
|
|
|
|
|
"définition non décorée de ``overload`` (pour la même fonction/méthode). Les "
|
|
|
|
|
"définitions décorées de ``@overload`` ne sont destinées qu'au vérificateur "
|
|
|
|
|
"de type, puisqu'elles sont écrasées par la définition non décorée de "
|
|
|
|
|
"``@overload`` ; cette dernière, en revanche, est utilisée à l'exécution mais "
|
|
|
|
|
"qu'il convient que le vérificateur de type l'ignore. Lors de l'exécution, "
|
|
|
|
|
"l'appel direct d'une fonction décorée avec ``@overload`` lèvera :exc:"
|
|
|
|
|
"`NotImplementedError`. Un exemple de surcharge qui donne un type plus précis "
|
|
|
|
|
"que celui qui peut être exprimé à l'aide d'une variable union ou type ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1548
|
|
|
|
|
msgid "See :pep:`484` for details and comparison with other typing semantics."
|
2019-09-04 09:35:23 +00:00
|
|
|
|
msgstr ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"Voir la :pep:`484` pour plus de détails et la comparaison avec d'autres "
|
|
|
|
|
"sémantiques de typage."
|
2019-09-04 09:35:23 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1552
|
2019-09-04 09:35:23 +00:00
|
|
|
|
msgid ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"A decorator to indicate to type checkers that the decorated method cannot be "
|
|
|
|
|
"overridden, and the decorated class cannot be subclassed. For example::"
|
2019-09-04 09:35:23 +00:00
|
|
|
|
msgstr ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"Un décorateur pour indiquer aux vérificateurs de types que la méthode "
|
|
|
|
|
"décorée ne peut pas être remplacée et que la classe décorée ne peut pas être "
|
|
|
|
|
"sous-classée. Par exemple ::"
|
2019-09-04 09:35:23 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1577
|
|
|
|
|
msgid "Decorator to indicate that annotations are not type hints."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"Décorateur pour indiquer que les annotations ne sont pas des indications de "
|
|
|
|
|
"type."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1579
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"This works as class or function :term:`decorator`. With a class, it applies "
|
|
|
|
|
"recursively to all methods defined in that class (but not to methods defined "
|
|
|
|
|
"in its superclasses or subclasses)."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"Cela fonctionne en tant que classe ou fonction :term:`décoratrice "
|
|
|
|
|
"<decorator>`. Avec une classe, elle s'applique récursivement à toutes les "
|
|
|
|
|
"méthodes définies dans cette classe (mais pas aux méthodes définies dans ses "
|
|
|
|
|
"superclasses ou sous-classes)."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1583
|
|
|
|
|
msgid "This mutates the function(s) in place."
|
|
|
|
|
msgstr "Cela fait muter la ou les fonctions en place."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1587
|
|
|
|
|
msgid "Decorator to give another decorator the :func:`no_type_check` effect."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"Décorateur pour donner à un autre décorateur l'effet :func:`no_type_check`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1589
|
2019-09-04 09:35:23 +00:00
|
|
|
|
msgid ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"This wraps the decorator with something that wraps the decorated function "
|
|
|
|
|
"in :func:`no_type_check`."
|
2019-09-04 09:35:23 +00:00
|
|
|
|
msgstr ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"Ceci enveloppe le décorateur avec quelque chose qui enveloppe la fonction "
|
|
|
|
|
"décorée dans :func:`no_type_check`."
|
2019-09-04 09:35:23 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1594
|
|
|
|
|
msgid "Decorator to mark a class or function to be unavailable at runtime."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"Décorateur pour marquer une classe ou une fonction comme étant indisponible "
|
|
|
|
|
"au moment de l'exécution."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1596
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"This decorator is itself not available at runtime. It is mainly intended to "
|
|
|
|
|
"mark classes that are defined in type stub files if an implementation "
|
|
|
|
|
"returns an instance of a private class::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"Ce décorateur n'est pas disponible à l'exécution. Il est principalement "
|
|
|
|
|
"destiné à marquer les classes qui sont définies dans des fichiers séparés "
|
|
|
|
|
"d'annotations de type (*type stub file*, en anglais) si une implémentation "
|
|
|
|
|
"renvoie une instance d'une classe privée ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1607
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"Note that returning instances of private classes is not recommended. It is "
|
|
|
|
|
"usually preferable to make such classes public."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"Notez qu'il n'est pas recommandé de renvoyer les instances des classes "
|
|
|
|
|
"privées. Il est généralement préférable de rendre ces classes publiques."
|
2017-05-27 17:46:38 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1611
|
|
|
|
|
msgid "Introspection helpers"
|
2017-05-27 17:46:38 +00:00
|
|
|
|
msgstr ""
|
2020-07-20 08:56:42 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1615
|
2020-07-20 08:56:42 +00:00
|
|
|
|
msgid ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"Return a dictionary containing type hints for a function, method, module or "
|
|
|
|
|
"class object."
|
2020-07-20 08:56:42 +00:00
|
|
|
|
msgstr ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"renvoie un dictionnaire contenant des indications de type pour une fonction, "
|
|
|
|
|
"une méthode, un module ou un objet de classe."
|
2020-07-20 08:56:42 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1618
|
2020-07-20 08:56:42 +00:00
|
|
|
|
msgid ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"This is often the same as ``obj.__annotations__``. In addition, forward "
|
|
|
|
|
"references encoded as string literals are handled by evaluating them in "
|
|
|
|
|
"``globals`` and ``locals`` namespaces. If necessary, ``Optional[t]`` is "
|
|
|
|
|
"added for function and method annotations if a default value equal to "
|
|
|
|
|
"``None`` is set. For a class ``C``, return a dictionary constructed by "
|
|
|
|
|
"merging all the ``__annotations__`` along ``C.__mro__`` in reverse order."
|
2020-07-20 08:56:42 +00:00
|
|
|
|
msgstr ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"C'est souvent équivalent à ``obj.__annotations__``. De plus, les références "
|
|
|
|
|
"directes encodées sous forme de chaîne littérales sont traitées en les "
|
|
|
|
|
"évaluant dans les espaces de nommage ``globals`` et ``locals``. Si "
|
|
|
|
|
"nécessaire, ``Optional[t]`` est ajouté pour les annotations de fonction et "
|
|
|
|
|
"de méthode si une valeur par défaut égale à ``None`` est définie. Pour une "
|
|
|
|
|
"classe ``C``, renvoie un dictionnaire construit en fusionnant toutes les "
|
|
|
|
|
"``__annotations__`` en parcourant ``C.__mro__`` en ordre inverse."
|
2020-07-20 08:56:42 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1626
|
2020-07-20 08:56:42 +00:00
|
|
|
|
msgid ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"The function recursively replaces all ``Annotated[T, ...]`` with ``T``, "
|
|
|
|
|
"unless ``include_extras`` is set to ``True`` (see :class:`Annotated` for "
|
|
|
|
|
"more information). For example::"
|
2020-07-20 08:56:42 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1639
|
|
|
|
|
msgid "Added ``include_extras`` parameter as part of :pep:`593`."
|
2020-07-20 08:56:42 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1645
|
|
|
|
|
msgid "Provide basic introspection for generic types and special typing forms."
|
2020-07-20 08:56:42 +00:00
|
|
|
|
msgstr ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"Fournit une introspection de base pour les types génériques et les formes "
|
|
|
|
|
"spéciales de typage."
|
2020-07-20 08:56:42 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1647
|
2020-07-20 08:56:42 +00:00
|
|
|
|
msgid ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"For a typing object of the form ``X[Y, Z, ...]`` these functions return "
|
|
|
|
|
"``X`` and ``(Y, Z, ...)``. If ``X`` is a generic alias for a builtin or :mod:"
|
|
|
|
|
"`collections` class, it gets normalized to the original class. For "
|
|
|
|
|
"unsupported objects return ``None`` and ``()`` correspondingly. Examples::"
|
2020-07-20 08:56:42 +00:00
|
|
|
|
msgstr ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"Pour un objet de typage de la forme ``X[Y, Z, ....]``, ces fonctions "
|
|
|
|
|
"renvoient ``X`` et ``(Y, Z,...)``. Si ``X`` est un alias pour une classe "
|
|
|
|
|
"native ou de :mod:`collections`, il est normalisé en la classe originale. "
|
|
|
|
|
"Pour les objets non gérés, renvoie la paire ``None`` , ``()``. Exemples ::"
|
2020-07-20 08:56:42 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1663
|
2020-07-20 08:56:42 +00:00
|
|
|
|
msgid ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"A class used for internal typing representation of string forward "
|
|
|
|
|
"references. For example, ``List[\"SomeClass\"]`` is implicitly transformed "
|
|
|
|
|
"into ``List[ForwardRef(\"SomeClass\")]``. This class should not be "
|
|
|
|
|
"instantiated by a user, but may be used by introspection tools."
|
2020-07-20 08:56:42 +00:00
|
|
|
|
msgstr ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"Une classe utilisée pour le typage interne de la représentation des "
|
|
|
|
|
"références directes des chaînes de caractères. Par exemple, "
|
|
|
|
|
"``Liste[\"SomeClass\"]`` est implicitement transformé en "
|
|
|
|
|
"``Liste[ForwardRef(\"SomeClass\")]``. Cette classe ne doit pas être "
|
|
|
|
|
"instanciée par un utilisateur, mais peut être utilisée par des outils "
|
|
|
|
|
"d'introspection."
|
2020-07-20 08:56:42 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1669
|
|
|
|
|
msgid "Constant"
|
2020-07-20 08:56:42 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1673
|
2020-07-20 08:56:42 +00:00
|
|
|
|
msgid ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"A special constant that is assumed to be ``True`` by 3rd party static type "
|
|
|
|
|
"checkers. It is ``False`` at runtime. Usage::"
|
2020-07-20 08:56:42 +00:00
|
|
|
|
msgstr ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"Constante spéciale qui vaut ``True`` pour les vérificateurs de type "
|
|
|
|
|
"statiques tiers et ``False`` à l'exécution. Utilisation ::"
|
2020-07-20 08:56:42 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1682
|
|
|
|
|
#, fuzzy
|
2020-07-20 08:56:42 +00:00
|
|
|
|
msgid ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"The first type annotation must be enclosed in quotes, making it a \"forward "
|
|
|
|
|
"reference\", to hide the ``expensive_mod`` reference from the interpreter "
|
|
|
|
|
"runtime. Type annotations for local variables are not evaluated, so the "
|
|
|
|
|
"second annotation does not need to be enclosed in quotes."
|
2020-07-20 08:56:42 +00:00
|
|
|
|
msgstr ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"Notez que la première annotation de type doit être entourée de guillemets, "
|
|
|
|
|
"ce qui en fait une « référence avant », pour cacher la référence "
|
|
|
|
|
"``expensive_mod`` au moment de l'exécution par l'interpréteur. Les "
|
|
|
|
|
"annotations de type pour les variables locales ne sont pas évaluées, de "
|
|
|
|
|
"sorte que la deuxième annotation n'a pas besoin d'être placée entre "
|
|
|
|
|
"guillemets."
|
2020-07-20 08:56:42 +00:00
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#: library/typing.rst:1689
|
|
|
|
|
msgid ""
|
|
|
|
|
"If ``from __future__ import annotations`` is used in Python 3.7 or later, "
|
|
|
|
|
"annotations are not evaluated at function definition time. Instead, the are "
|
|
|
|
|
"stored as strings in ``__annotations__``, This makes it unnecessary to use "
|
|
|
|
|
"quotes around the annotation. (see :pep:`563`)."
|
2020-07-20 08:56:42 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#~ msgid ""
|
|
|
|
|
#~ "**Warning:** this will check only the presence of the required methods, "
|
|
|
|
|
#~ "not their type signatures!"
|
|
|
|
|
#~ msgstr ""
|
|
|
|
|
#~ "**Attention :** ceci ne vérifiera que la présence des méthodes requises, "
|
|
|
|
|
#~ "et non leur signature de type !"
|