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"
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"POT-Creation-Date: 2023-07-23 14:38+0200\n"
|
2023-02-17 16:53:03 +00:00
|
|
|
|
"PO-Revision-Date: 2023-02-17 16:13+0100\n"
|
|
|
|
|
"Last-Translator: Nicolas Gibaud <nicolas.gibaud7@gmail.com>\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"
|
2023-02-17 16:53:03 +00:00
|
|
|
|
"X-Generator: Poedit 2.3\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
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:16
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid "**Source code:** :source:`Lib/typing.py`"
|
|
|
|
|
msgstr "**Code source :** :source:`Lib/typing.py`"
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:20
|
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
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:26
|
|
|
|
|
#, fuzzy
|
2017-04-02 20:14:06 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"This module provides runtime support for type hints. For the original "
|
|
|
|
|
"specification of the typing system, see :pep:`484`. For a simplified "
|
|
|
|
|
"introduction to type hints, see :pep:`483`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
2022-12-10 17:43:45 +00:00
|
|
|
|
"Ce module fournit la gestion des annotations de type à l'exécution. La prise "
|
|
|
|
|
"en compte de base comprend les types :data:`Any`, :data:`Union`, :data:"
|
2020-05-03 15:12:15 +00:00
|
|
|
|
"`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
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:31
|
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
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:36
|
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
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:40
|
2022-03-23 17:40:12 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"New features are frequently added to the ``typing`` module. The "
|
|
|
|
|
"`typing_extensions <https://pypi.org/project/typing-extensions/>`_ package "
|
|
|
|
|
"provides backports of these new features to older versions of Python."
|
|
|
|
|
msgstr ""
|
2023-02-17 16:53:03 +00:00
|
|
|
|
"Le module ``typing`` est fréquemment enrichi de nouvelles fonctionnalités. "
|
|
|
|
|
"Le package `typing_extensions <https://pypi.org/project/typing-extensions/"
|
|
|
|
|
">`_ fournit des rétro-portages de ces fonctionnalités vers les anciennes "
|
|
|
|
|
"versions de Python."
|
2022-03-23 17:40:12 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:44
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"For a summary of deprecated features and a deprecation timeline, please see "
|
|
|
|
|
"`Deprecation Timeline of Major Features`_."
|
|
|
|
|
msgstr ""
|
2023-02-17 16:53:03 +00:00
|
|
|
|
"Pour un résumé des fonctionnalités obsolètes et leur planification "
|
|
|
|
|
"d'obsolescence, consultez les `Etapes d'Obsolescence des Fonctionnalités "
|
|
|
|
|
"Majeures`_."
|
2022-05-22 21:15:02 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:50
|
|
|
|
|
msgid ""
|
|
|
|
|
"`\"Typing cheat sheet\" <https://mypy.readthedocs.io/en/stable/"
|
|
|
|
|
"cheat_sheet_py3.html>`_"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:50
|
|
|
|
|
msgid "A quick overview of type hints (hosted at the mypy docs)"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:55
|
|
|
|
|
msgid ""
|
|
|
|
|
"\"Type System Reference\" section of `the mypy docs <https://mypy."
|
|
|
|
|
"readthedocs.io/en/stable/index.html>`_"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:53
|
2023-01-15 21:42:07 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"The Python typing system is standardised via PEPs, so this reference should "
|
|
|
|
|
"broadly apply to most Python type checkers. (Some parts may still be "
|
|
|
|
|
"specific to mypy.)"
|
2023-04-14 11:20:40 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:59
|
2023-04-14 11:20:40 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"`\"Static Typing with Python\" <https://typing.readthedocs.io/en/latest/>`_"
|
2023-04-14 11:20:40 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:58
|
|
|
|
|
#, fuzzy
|
2023-04-14 11:20:40 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Type-checker-agnostic documentation written by the community detailing type "
|
|
|
|
|
"system features, useful typing related tools and typing best practices."
|
2023-01-15 21:42:07 +00:00
|
|
|
|
msgstr ""
|
2023-02-17 16:53:03 +00:00
|
|
|
|
"La documentation https://typing.readthedocs.io/ est une référence utile pour "
|
|
|
|
|
"les fonctionnalités du système de types, les outils liés au typage et les "
|
|
|
|
|
"bonnes pratiques de typage.La documentation sur https://typing.readthedocs."
|
|
|
|
|
"io/ sert de référence pour les fonctionnalités, les outils utiles et les "
|
|
|
|
|
"meilleures pratiques liés au système de typage."
|
2023-01-15 21:42:07 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:65
|
2021-11-05 22:32:47 +00:00
|
|
|
|
msgid "Relevant PEPs"
|
2023-02-17 16:53:03 +00:00
|
|
|
|
msgstr "PEPs pertinentes"
|
2021-11-05 22:32:47 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:67
|
|
|
|
|
#, fuzzy
|
2021-11-05 22:32:47 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Since the initial introduction of type hints in :pep:`484` and :pep:`483`, a "
|
|
|
|
|
"number of PEPs have modified and enhanced Python's framework for type "
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"annotations:"
|
2021-11-05 22:32:47 +00:00
|
|
|
|
msgstr ""
|
2023-02-17 16:53:03 +00:00
|
|
|
|
"Depuis l'introduction initiale des annotations de type dans les :pep:`484` "
|
|
|
|
|
"et :pep:`483`, plusieurs PEPs ont modifié et amélioré le framework "
|
|
|
|
|
"d'annotation de type. Cela inclut :"
|
2021-11-05 22:32:47 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:77
|
2021-11-05 22:32:47 +00:00
|
|
|
|
msgid ":pep:`526`: Syntax for Variable Annotations"
|
2023-02-17 16:53:03 +00:00
|
|
|
|
msgstr ":pep:`526` : Syntaxe pour les Annotations de Variables"
|
2021-11-05 22:32:47 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:77
|
2021-11-05 22:32:47 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"*Introducing* syntax for annotating variables outside of function "
|
|
|
|
|
"definitions, and :data:`ClassVar`"
|
|
|
|
|
msgstr ""
|
2023-02-17 16:53:03 +00:00
|
|
|
|
"*Introduction* d'une syntaxe permettant d'annoter les variables autrement "
|
|
|
|
|
"qu'au sein de la définition d'une fonction et de :data:`ClassVar`"
|
2021-11-05 22:32:47 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:80
|
2021-11-05 22:32:47 +00:00
|
|
|
|
msgid ":pep:`544`: Protocols: Structural subtyping (static duck typing)"
|
|
|
|
|
msgstr ""
|
2023-02-17 16:53:03 +00:00
|
|
|
|
":pep:`544`: Protocoles : Sous-typage Structurel (*duck-typing* statique)"
|
2021-11-05 22:32:47 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:80
|
2021-11-05 22:32:47 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"*Introducing* :class:`Protocol` and the :func:"
|
|
|
|
|
"`@runtime_checkable<runtime_checkable>` decorator"
|
|
|
|
|
msgstr ""
|
2023-02-17 16:53:03 +00:00
|
|
|
|
"*Ajout* de :class:`Protocol` et du décorateur :func:"
|
|
|
|
|
"`@runtime_checkable<runtime_checkable>`"
|
2021-11-05 22:32:47 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:83
|
2021-11-05 22:32:47 +00:00
|
|
|
|
msgid ":pep:`585`: Type Hinting Generics In Standard Collections"
|
2023-02-17 16:53:03 +00:00
|
|
|
|
msgstr ":pep:`585`: Annotations de Type Générique dans les Collections Natives"
|
2021-11-05 22:32:47 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:83
|
2021-11-05 22:32:47 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"*Introducing* :class:`types.GenericAlias` and the ability to use standard "
|
|
|
|
|
"library classes as :ref:`generic types<types-genericalias>`"
|
|
|
|
|
msgstr ""
|
2023-02-17 16:53:03 +00:00
|
|
|
|
"*Ajout* de :class:`types.GenericAlias` et de la possibilité d'utiliser les "
|
|
|
|
|
"classes de bibliothèques natives comme les :ref:`types génériques<types-"
|
|
|
|
|
"genericalias>`"
|
2021-11-05 22:32:47 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:85
|
2021-11-05 22:32:47 +00:00
|
|
|
|
msgid ":pep:`586`: Literal Types"
|
2023-02-17 16:53:03 +00:00
|
|
|
|
msgstr ":pep:`586`: Types Littéraux"
|
2021-11-05 22:32:47 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:86
|
2021-11-05 22:32:47 +00:00
|
|
|
|
msgid "*Introducing* :data:`Literal`"
|
2023-02-17 16:53:03 +00:00
|
|
|
|
msgstr "*Ajout* de :data:`Literal`"
|
2021-11-05 22:32:47 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:87
|
2021-11-05 22:32:47 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
":pep:`589`: TypedDict: Type Hints for Dictionaries with a Fixed Set of Keys"
|
|
|
|
|
msgstr ""
|
2023-02-17 16:53:03 +00:00
|
|
|
|
":pep:`589`: TypedDict: Annotations de Type pour les Dictionnaires ayant un "
|
|
|
|
|
"Ensemble Fixe de Clés"
|
2021-11-05 22:32:47 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:88
|
2021-11-05 22:32:47 +00:00
|
|
|
|
msgid "*Introducing* :class:`TypedDict`"
|
2023-02-17 16:53:03 +00:00
|
|
|
|
msgstr "*Ajout* de :class:`TypedDict`"
|
2021-11-05 22:32:47 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:89
|
2021-11-05 22:32:47 +00:00
|
|
|
|
msgid ":pep:`591`: Adding a final qualifier to typing"
|
2023-02-17 16:53:03 +00:00
|
|
|
|
msgstr ":pep:`591`: Ajout d'un qualificatif final au typage"
|
2021-11-05 22:32:47 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:90
|
2021-11-05 22:32:47 +00:00
|
|
|
|
msgid "*Introducing* :data:`Final` and the :func:`@final<final>` decorator"
|
2023-02-17 16:53:03 +00:00
|
|
|
|
msgstr "*Ajout* de :data:`Final` et du décorateur :func:`@final<final>`"
|
2021-11-05 22:32:47 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:91
|
2021-11-05 22:32:47 +00:00
|
|
|
|
msgid ":pep:`593`: Flexible function and variable annotations"
|
2023-02-17 16:53:03 +00:00
|
|
|
|
msgstr ":pep:`593`: fonction Flexible et annotations de variables"
|
2021-11-05 22:32:47 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:92
|
2021-11-05 22:32:47 +00:00
|
|
|
|
msgid "*Introducing* :data:`Annotated`"
|
2023-02-17 16:53:03 +00:00
|
|
|
|
msgstr "*Ajout* de :data:`Annotated`"
|
2021-11-05 22:32:47 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:95
|
2021-11-05 22:32:47 +00:00
|
|
|
|
msgid ":pep:`604`: Allow writing union types as ``X | Y``"
|
2023-02-17 16:53:03 +00:00
|
|
|
|
msgstr ":pep:`604`: Permettre l'écriture de types union tels que ``X | Y``"
|
2021-11-05 22:32:47 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:94
|
2021-11-05 22:32:47 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"*Introducing* :data:`types.UnionType` and the ability to use the binary-or "
|
|
|
|
|
"operator ``|`` to signify a :ref:`union of types<types-union>`"
|
|
|
|
|
msgstr ""
|
2023-02-17 16:53:03 +00:00
|
|
|
|
"*Ajout* de :data:`types.UnionType` et la possibilité d'utiliser l'opérateur "
|
|
|
|
|
"binaire ``|`` (*ou*) pour signifier :ref:`union of types<types-union>`"
|
2021-11-05 22:32:47 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:97
|
2021-11-05 22:32:47 +00:00
|
|
|
|
msgid ":pep:`612`: Parameter Specification Variables"
|
2023-02-17 16:53:03 +00:00
|
|
|
|
msgstr ":pep:`612`: Variables de Spécification de Paramètre"
|
2021-11-05 22:32:47 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:98
|
2021-11-05 22:32:47 +00:00
|
|
|
|
msgid "*Introducing* :class:`ParamSpec` and :data:`Concatenate`"
|
2023-02-17 16:53:03 +00:00
|
|
|
|
msgstr "*Ajout* de :class:`ParamSpec` et de :data:`Concatenate`"
|
2021-11-05 22:32:47 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:99
|
2021-11-05 22:32:47 +00:00
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid ":pep:`613`: Explicit Type Aliases"
|
2023-02-17 16:53:03 +00:00
|
|
|
|
msgstr ":pep:`613`: Alias de Type Explicites"
|
2021-11-05 22:32:47 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:100
|
2021-11-05 22:32:47 +00:00
|
|
|
|
msgid "*Introducing* :data:`TypeAlias`"
|
2023-02-17 16:53:03 +00:00
|
|
|
|
msgstr "*Ajout* de :data:`TypeAlias`"
|
2021-11-05 22:32:47 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:101
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgid ":pep:`646`: Variadic Generics"
|
2023-02-17 16:53:03 +00:00
|
|
|
|
msgstr ":pep:`646`: Génériques Variadiques"
|
2022-05-22 21:15:02 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:102
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgid "*Introducing* :data:`TypeVarTuple`"
|
2023-02-17 16:53:03 +00:00
|
|
|
|
msgstr "*Ajout* de :data:`TypeVarTuple`"
|
2022-05-22 21:15:02 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:103
|
2021-11-05 22:32:47 +00:00
|
|
|
|
msgid ":pep:`647`: User-Defined Type Guards"
|
2023-02-17 16:53:03 +00:00
|
|
|
|
msgstr ":pep:`647`: Gardes de Types Définies par l'Utilisateur"
|
2021-11-05 22:32:47 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:104
|
2021-11-05 22:32:47 +00:00
|
|
|
|
msgid "*Introducing* :data:`TypeGuard`"
|
2023-02-17 16:53:03 +00:00
|
|
|
|
msgstr "*Ajout* de :data:`TypeGuard`"
|
2021-11-05 22:32:47 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:105
|
2023-01-15 21:42:07 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
":pep:`655`: Marking individual TypedDict items as required or potentially "
|
|
|
|
|
"missing"
|
|
|
|
|
msgstr ""
|
2023-02-17 16:53:03 +00:00
|
|
|
|
":pep:`655`: Marquer les items individuels TypedDict comme nécessaires ou "
|
|
|
|
|
"potentiellement manquants"
|
2023-01-15 21:42:07 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:106
|
2023-01-15 21:42:07 +00:00
|
|
|
|
msgid "*Introducing* :data:`Required` and :data:`NotRequired`"
|
2023-02-17 16:53:03 +00:00
|
|
|
|
msgstr "*Ajout* de :data:`Required` et de :data:`NotRequired`"
|
2023-01-15 21:42:07 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:107
|
2022-03-23 17:40:12 +00:00
|
|
|
|
msgid ":pep:`673`: Self type"
|
2023-02-17 16:53:03 +00:00
|
|
|
|
msgstr ":pep:`673`: Type self"
|
2022-03-23 17:40:12 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:108
|
2022-03-23 17:40:12 +00:00
|
|
|
|
msgid "*Introducing* :data:`Self`"
|
2023-02-17 16:53:03 +00:00
|
|
|
|
msgstr "*Ajout* de :data:`Self`"
|
2022-03-23 17:40:12 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:109
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgid ":pep:`675`: Arbitrary Literal String Type"
|
2023-02-17 16:53:03 +00:00
|
|
|
|
msgstr ":pep:`675`: Type String Littéral Arbitraire"
|
2022-05-22 21:15:02 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:110
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgid "*Introducing* :data:`LiteralString`"
|
2023-02-17 16:53:03 +00:00
|
|
|
|
msgstr "*Ajout* de :data:`LiteralString`"
|
2022-05-22 21:15:02 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:112
|
2023-01-15 21:42:07 +00:00
|
|
|
|
msgid ":pep:`681`: Data Class Transforms"
|
2023-02-17 16:53:03 +00:00
|
|
|
|
msgstr ":pep:`681`: Transformateurs de Classes de Données"
|
2023-01-15 21:42:07 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:112
|
2023-01-15 21:42:07 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"*Introducing* the :func:`@dataclass_transform<dataclass_transform>` decorator"
|
|
|
|
|
msgstr ""
|
2023-02-17 16:53:03 +00:00
|
|
|
|
"*Ajout* du décorateur :func:`@dataclass_transform<dataclass_transform>`"
|
2023-01-15 21:42:07 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:122
|
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
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:124
|
2020-10-02 08:55:01 +00:00
|
|
|
|
#, fuzzy
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"A type alias is defined by assigning the type to the alias. In this example, "
|
2020-10-02 08:55:01 +00:00
|
|
|
|
"``Vector`` and ``list[float]`` will be treated as interchangeable synonyms::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
2023-02-17 16:53:03 +00:00
|
|
|
|
"Un alias de type est défini en affectant le type à l'alias. Dans cet "
|
2020-05-03 15:12:15 +00:00
|
|
|
|
"exemple, ``Vector`` et ``List[float]`` sont traités comme des synonymes "
|
|
|
|
|
"interchangeables ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:135
|
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
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:153
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Type aliases may be marked with :data:`TypeAlias` to make it explicit that "
|
|
|
|
|
"the statement is a type alias declaration, not a normal variable assignment::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:163
|
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
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:165
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgid "Use the :class:`NewType` helper to create distinct types::"
|
2023-02-17 16:53:03 +00:00
|
|
|
|
msgstr "Utilisez la classe :class:`NewType` pour créer des types distincts ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:172
|
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 ""
|
2023-02-17 16:53:03 +00:00
|
|
|
|
"Le vérificateur de types statiques traite le nouveau type comme s'il "
|
2020-05-03 15:12:15 +00:00
|
|
|
|
"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
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:184
|
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
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:192
|
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 "
|
2022-05-22 21:15:02 +00:00
|
|
|
|
"``Derived`` a callable that immediately returns whatever parameter you pass "
|
|
|
|
|
"it. That means the expression ``Derived(some_value)`` does not create a new "
|
2021-09-24 08:20:01 +00:00
|
|
|
|
"class or introduce much overhead beyond that of a regular function call."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
2023-02-17 16:53:03 +00:00
|
|
|
|
"Notez que ces contrôles ne sont exécutés que par le vérificateur de types "
|
2020-05-03 15:12:15 +00:00
|
|
|
|
"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 "
|
2023-02-17 16:53:03 +00:00
|
|
|
|
"``Derived(some_value)`` ne crée pas une nouvelle classe et n'introduit pas "
|
2020-05-03 15:12:15 +00:00
|
|
|
|
"de surcharge au-delà de celle d'un appel de fonction normal."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:198
|
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
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:201
|
2021-09-24 08:20:01 +00:00
|
|
|
|
msgid "It is invalid to create a subtype of ``Derived``::"
|
2023-04-08 12:37:28 +00:00
|
|
|
|
msgstr "La création d'un sous-type de ``Derived`` est invalide ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:210
|
2017-12-01 06:48:13 +00:00
|
|
|
|
msgid ""
|
2021-09-24 08:20:01 +00:00
|
|
|
|
"However, it is possible to create a :class:`NewType` based on a 'derived' "
|
2017-12-01 06:48:13 +00:00
|
|
|
|
"``NewType``::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
2023-02-17 16:53:03 +00:00
|
|
|
|
"Il est néanmoins possible de créer un :class:`NewType` basé sur un "
|
2021-09-16 10:45:56 +00:00
|
|
|
|
"``NewType`` « dérivé » ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:218
|
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
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:220
|
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
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:224
|
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 "
|
2023-02-17 16:53:03 +00:00
|
|
|
|
"vérificateur de types statiques traite ``Alias`` comme étant *exactement "
|
2020-05-03 15:12:15 +00:00
|
|
|
|
"équivalent* à ``Original`` dans tous les cas. C'est utile lorsque vous "
|
|
|
|
|
"voulez simplifier des signatures complexes."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:229
|
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. "
|
2023-02-17 16:53:03 +00:00
|
|
|
|
"Écrire ``Derived = NewType('Derived', Original)`` fait 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
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:238
|
|
|
|
|
#, fuzzy
|
2021-09-24 08:20:01 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"``NewType`` is now a class rather than a function. As a result, there is "
|
|
|
|
|
"some additional runtime cost when calling ``NewType`` over a regular "
|
|
|
|
|
"function."
|
2021-09-24 08:20:01 +00:00
|
|
|
|
msgstr ""
|
2023-02-17 16:53:03 +00:00
|
|
|
|
"``NewType`` est maintenant une classe (plutôt qu'une fonction). Cela "
|
|
|
|
|
"entraine un coût supplémentaire en temps d'exécution lors d'un appel. "
|
|
|
|
|
"Cependant, ce coût sera réduit dans la version 3.11.0."
|
2021-09-24 08:20:01 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:243
|
|
|
|
|
msgid ""
|
|
|
|
|
"The performance of calling ``NewType`` has been restored to its level in "
|
|
|
|
|
"Python 3.9."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:250
|
|
|
|
|
msgid "Annotating callable objects"
|
|
|
|
|
msgstr ""
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:252
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Functions -- or other :term:`callable` objects -- can be annotated using :"
|
|
|
|
|
"class:`collections.abc.Callable` or :data:`typing.Callable`. "
|
|
|
|
|
"``Callable[[int], str]`` signifies a function that takes a single parameter "
|
|
|
|
|
"of type :class:`int` and returns a :class:`str`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2684
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "For example:"
|
2018-07-03 09:49:47 +00:00
|
|
|
|
msgstr "Par exemple ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:275
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid ""
|
|
|
|
|
"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, a :class:`ParamSpec`, :data:`Concatenate`, or an ellipsis. The return "
|
|
|
|
|
"type must be a single type."
|
|
|
|
|
msgstr ""
|
|
|
|
|
"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."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:280
|
|
|
|
|
msgid ""
|
|
|
|
|
"If a literal ellipsis ``...`` is given as the argument list, it indicates "
|
|
|
|
|
"that a callable with any arbitrary parameter list would be acceptable:"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:292
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"``Callable`` cannot express complex signatures such as functions that take a "
|
|
|
|
|
"variadic number of arguments, :func:`overloaded functions <overload>`, or "
|
|
|
|
|
"functions that have keyword-only parameters. However, these signatures can "
|
|
|
|
|
"be expressed by defining a :class:`Protocol` class with a :meth:`~object."
|
|
|
|
|
"__call__` method:"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:319
|
2021-09-24 08:20:01 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Callables which take other callables as arguments may indicate that their "
|
|
|
|
|
"parameter types are dependent on each other using :class:`ParamSpec`. "
|
|
|
|
|
"Additionally, if that callable adds or removes arguments from other "
|
|
|
|
|
"callables, the :data:`Concatenate` operator may be used. They take the form "
|
|
|
|
|
"``Callable[ParamSpecVariable, ReturnType]`` and "
|
|
|
|
|
"``Callable[Concatenate[Arg1Type, Arg2Type, ..., ParamSpecVariable], "
|
|
|
|
|
"ReturnType]`` respectively."
|
|
|
|
|
msgstr ""
|
2023-02-17 16:53:03 +00:00
|
|
|
|
"Les appelables qui prennent en argument d'autres appelables peuvent indiquer "
|
|
|
|
|
"que leurs types de paramètres dépendent les uns des autres en utilisant :"
|
|
|
|
|
"class:`ParamSpec`. De plus, si un appelable ajoute ou supprime des arguments "
|
|
|
|
|
"d'autres appelables, l'opérateur :data:`Concatenate` peut être utilisé. Ils "
|
|
|
|
|
"prennent la forme ``Callable[ParamSpecVariable, ReturnType]`` et "
|
|
|
|
|
"``Callable[Concatenate[Arg1Type, Arg2Type, ..., ParamSpecVariable], "
|
|
|
|
|
"ReturnType]`` respectivement."
|
2021-09-24 08:20:01 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:3211
|
2021-09-24 08:20:01 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"``Callable`` now supports :class:`ParamSpec` and :data:`Concatenate`. See :"
|
2023-01-15 21:42:07 +00:00
|
|
|
|
"pep:`612` for more details."
|
2021-09-24 08:20:01 +00:00
|
|
|
|
msgstr ""
|
2023-02-17 16:53:03 +00:00
|
|
|
|
"``Callable`` prend désormais en charge :class:`ParamSpec` et :data:"
|
|
|
|
|
"`Concatenate`. Voir :pep:`612` pour plus de détails."
|
2021-09-24 08:20:01 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:332
|
2021-09-24 08:20:01 +00:00
|
|
|
|
msgid ""
|
2022-05-22 21:15:02 +00:00
|
|
|
|
"The documentation for :class:`ParamSpec` and :class:`Concatenate` provides "
|
2021-09-24 08:20:01 +00:00
|
|
|
|
"examples of usage in ``Callable``."
|
|
|
|
|
msgstr ""
|
2023-02-17 16:53:03 +00:00
|
|
|
|
"La documentation pour :class:`ParamSpec` et :class:`Concatenate` fournit des "
|
|
|
|
|
"exemples d'utilisation dans ``Callable``."
|
2021-09-24 08:20:01 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:338
|
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
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:340
|
|
|
|
|
#, fuzzy
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Since type information about objects kept in containers cannot be statically "
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"inferred in a generic way, many container classes in the standard library "
|
|
|
|
|
"support subscription to denote the expected types of container elements."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
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 "
|
2022-12-06 09:20:23 +00:00
|
|
|
|
"mères abstraites ont été étendues pour prendre en charge la sélection "
|
2020-05-03 15:12:15 +00:00
|
|
|
|
"(*subscription* en anglais) et indiquer les types attendus pour les éléments "
|
|
|
|
|
"de conteneur."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:357
|
2022-03-23 17:40:12 +00:00
|
|
|
|
#, fuzzy
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
2022-03-23 17:40:12 +00:00
|
|
|
|
"Generics can be parameterized by using a factory available in typing called :"
|
|
|
|
|
"class:`TypeVar`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
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
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:373
|
|
|
|
|
msgid "Annotating tuples"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:375
|
|
|
|
|
msgid ""
|
|
|
|
|
"For most containers in Python, the typing system assumes that all elements "
|
|
|
|
|
"in the container will be of the same type. For example::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:390
|
|
|
|
|
msgid ""
|
|
|
|
|
":class:`list` only accepts one type argument, so a type checker would emit "
|
|
|
|
|
"an error on the ``y`` assignment above. Similarly, :class:`~collections.abc."
|
|
|
|
|
"Mapping` only accepts two type arguments: the first indicates the type of "
|
|
|
|
|
"the keys, and the second indicates the type of the values."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:396
|
|
|
|
|
msgid ""
|
|
|
|
|
"Unlike most other Python containers, however, it is common in idiomatic "
|
|
|
|
|
"Python code for tuples to have elements which are not all of the same type. "
|
|
|
|
|
"For this reason, tuples are special-cased in Python's typing system. :class:"
|
|
|
|
|
"`tuple` accepts *any number* of type arguments::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:412
|
|
|
|
|
msgid ""
|
|
|
|
|
"To denote a tuple which could be of *any* length, and in which all elements "
|
|
|
|
|
"are of the same type ``T``, use ``tuple[T, ...]``. To denote an empty tuple, "
|
|
|
|
|
"use ``tuple[()]``. Using plain ``tuple`` as an annotation is equivalent to "
|
|
|
|
|
"using ``tuple[Any, ...]``::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:435
|
|
|
|
|
msgid "The type of class objects"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:437
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid ""
|
|
|
|
|
"A variable annotated with ``C`` may accept a value of type ``C``. In "
|
|
|
|
|
"contrast, a variable annotated with ``type[C]`` (or :class:`typing.Type[C] "
|
|
|
|
|
"<Type>`) may accept values that are classes themselves -- specifically, it "
|
|
|
|
|
"will accept the *class object* of ``C``. For example::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
"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 ::"
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:447
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "Note that ``type[C]`` is covariant::"
|
|
|
|
|
msgstr "Notez que ``Type[C]`` est covariant ::"
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:463
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid ""
|
|
|
|
|
"The only legal parameters for :class:`type` are classes, :data:`Any`, :ref:"
|
|
|
|
|
"`type variables <generics>`, and unions of any of these types. For example::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
"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 ::"
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:475
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid ""
|
|
|
|
|
"``type[Any]`` is equivalent to :class:`type`, which is the root of Python's :"
|
|
|
|
|
"ref:`metaclass hierarchy <metaclasses>`."
|
|
|
|
|
msgstr ""
|
|
|
|
|
"``Type[Any]`` est équivalent à ``Type`` qui à son tour est équivalent à "
|
|
|
|
|
"``type``, qui est la racine de la hiérarchie des métaclasses de Python."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:481
|
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
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:483
|
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
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:509
|
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 ""
|
2022-12-06 09:20:23 +00:00
|
|
|
|
"``Generic[T]`` en tant que classe mère 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
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:513
|
2021-11-05 22:32:47 +00:00
|
|
|
|
#, fuzzy
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
2021-11-05 22:32:47 +00:00
|
|
|
|
"The :class:`Generic` base class defines :meth:`~object.__class_getitem__` so "
|
2023-01-15 21:42:07 +00:00
|
|
|
|
"that ``LoggedVar[T]`` is valid as a type::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
2022-12-06 09:20:23 +00:00
|
|
|
|
"La classe mère :class:`Generic` définit :meth:`__class_getitem__` de sorte "
|
|
|
|
|
"que ``LoggedVar[t]`` est valide comme type ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:522
|
2022-03-23 17:40:12 +00:00
|
|
|
|
#, fuzzy
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
2022-03-23 17:40:12 +00:00
|
|
|
|
"A generic type can have any number of type variables. All varieties of :"
|
|
|
|
|
"class:`TypeVar` are permissible as parameters for a generic type::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
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
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:534
|
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
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:545
|
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
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:555
|
|
|
|
|
#, fuzzy
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"When inheriting from generic classes, some type parameters could be fixed::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
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
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:565
|
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
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:567
|
|
|
|
|
#, fuzzy
|
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 "
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"but implicitly inherits from ``Iterable[Any]``:"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
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
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:578
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "User-defined generic type aliases are also supported. Examples::"
|
2017-04-02 20:14:06 +00:00
|
|
|
|
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
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:595
|
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
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:598
|
2021-09-24 08:20:01 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"User-defined generics for parameter expressions are also supported via "
|
|
|
|
|
"parameter specification variables in the form ``Generic[P]``. The behavior "
|
|
|
|
|
"is consistent with type variables' described above as parameter "
|
|
|
|
|
"specification variables are treated by the typing module as a specialized "
|
|
|
|
|
"type variable. The one exception to this is that a list of types can be "
|
|
|
|
|
"used to substitute a :class:`ParamSpec`::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:614
|
2021-09-24 08:20:01 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Furthermore, a generic with only one parameter specification variable will "
|
|
|
|
|
"accept parameter lists in the forms ``X[[Type1, Type2, ...]]`` and also "
|
|
|
|
|
"``X[Type1, Type2, ...]`` for aesthetic reasons. Internally, the latter is "
|
2022-05-22 21:15:02 +00:00
|
|
|
|
"converted to the former, so the following are equivalent::"
|
2021-09-24 08:20:01 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:626
|
2021-09-24 08:20:01 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Note that generics with :class:`ParamSpec` may not have correct "
|
2021-09-24 08:20:01 +00:00
|
|
|
|
"``__parameters__`` after substitution in some cases because they are "
|
|
|
|
|
"intended primarily for static type checking."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:630
|
2021-09-24 08:20:01 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
":class:`Generic` can now be parameterized over parameter expressions. See :"
|
|
|
|
|
"class:`ParamSpec` and :pep:`612` for more details."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:634
|
2023-04-14 11:20:40 +00:00
|
|
|
|
#, fuzzy
|
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 "
|
2023-04-14 11:20:40 +00:00
|
|
|
|
"parameterizing generics is cached, and most types in the typing module are :"
|
|
|
|
|
"term:`hashable` and comparable for equality."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
2022-12-06 09:20:23 +00:00
|
|
|
|
"Une classe générique définie par l'utilisateur peut avoir des classes mères "
|
|
|
|
|
"abstraites (ABC pour *Abstract Base Classes* en anglais) 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
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:641
|
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
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:643
|
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 ""
|
2023-02-17 16:53:03 +00:00
|
|
|
|
"Un type particulier est :data:`Any`. Un vérificateur de types statiques "
|
|
|
|
|
"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
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:647
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#, 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
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:665
|
2023-01-15 21:42:07 +00:00
|
|
|
|
#, fuzzy
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
2023-01-15 21:42:07 +00:00
|
|
|
|
"Notice that no type checking is performed when assigning a value of type :"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
"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 "
|
2023-02-17 16:53:03 +00:00
|
|
|
|
"vérificateur de types statiques 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
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:671
|
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
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:684
|
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
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:687
|
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
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:692
|
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 "
|
2023-02-17 16:53:03 +00:00
|
|
|
|
"vérificateur de types rejette presque toutes les opérations sur celle-ci, et "
|
2020-05-03 15:12:15 +00:00
|
|
|
|
"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
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:714
|
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
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:719
|
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
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:721
|
2022-05-22 21:15:02 +00:00
|
|
|
|
#, fuzzy
|
2019-09-04 09:35:23 +00:00
|
|
|
|
msgid ""
|
2022-05-22 21:15:02 +00:00
|
|
|
|
"Initially :pep:`484` defined the Python static type system as using *nominal "
|
2019-09-04 09:35:23 +00:00
|
|
|
|
"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
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:725
|
2020-10-16 06:41:36 +00:00
|
|
|
|
#, fuzzy
|
2019-09-04 09:35:23 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"This requirement previously also applied to abstract base classes, such as :"
|
2020-10-16 06:41:36 +00:00
|
|
|
|
"class:`~collections.abc.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 :pep:`484`::"
|
2019-09-04 09:35:23 +00:00
|
|
|
|
msgstr ""
|
2022-12-06 09:20:23 +00:00
|
|
|
|
"Ce pré-requis s'appliquait auparavant aussi aux classes mères abstraites, "
|
2020-05-03 15:12:15 +00:00
|
|
|
|
"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
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:738
|
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 "
|
2022-12-06 09:20:23 +00:00
|
|
|
|
"d'écrire le code ci-dessus sans classes mères 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
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:754
|
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
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:759
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgid "Module contents"
|
|
|
|
|
msgstr ""
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:761
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"The ``typing`` module defines the following classes, functions and "
|
|
|
|
|
"decorators."
|
|
|
|
|
msgstr "Ce module définit les classes, fonctions et décorateurs suivants :"
|
2020-09-11 07:11:46 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:764
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgid "Special typing primitives"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:767
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "Special types"
|
|
|
|
|
msgstr "Type « optionnel »."
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:769
|
|
|
|
|
msgid ""
|
|
|
|
|
"These can be used as types in annotations. They do not support subscription "
|
|
|
|
|
"using ``[]``."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:774
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgid "Special type indicating an unconstrained type."
|
|
|
|
|
msgstr "Type spécial indiquant un type non contraint."
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:776
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgid "Every type is compatible with :data:`Any`."
|
|
|
|
|
msgstr "Chaque type est compatible avec :data:`Any`."
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:777
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgid ":data:`Any` is compatible with every type."
|
|
|
|
|
msgstr ":data:`Any` est compatible avec tous les types."
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:779
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
":data:`Any` can now be used as a base class. This can be useful for avoiding "
|
|
|
|
|
"type checker errors with classes that can duck type anywhere or are highly "
|
|
|
|
|
"dynamic."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:786
|
|
|
|
|
msgid "A :ref:`constrained type variable <typing-constrained-typevar>`."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:788
|
|
|
|
|
msgid "Definition::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:792
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid ""
|
|
|
|
|
"``AnyStr`` is meant to be used for functions that may accept :class:`str` "
|
|
|
|
|
"or :class:`bytes` arguments but cannot allow the two to mix."
|
|
|
|
|
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 ::"
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:871 library/typing.rst:937 library/typing.rst:1153
|
|
|
|
|
#: library/typing.rst:2524
|
|
|
|
|
msgid "For example::"
|
|
|
|
|
msgstr "Par exemple ::"
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:806
|
|
|
|
|
msgid "Special type that includes only literal strings."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:808
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Any string literal is compatible with ``LiteralString``, as is another "
|
|
|
|
|
"``LiteralString``. However, an object typed as just ``str`` is not. A string "
|
|
|
|
|
"created by composing ``LiteralString``-typed objects is also acceptable as a "
|
|
|
|
|
"``LiteralString``."
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:814
|
2022-05-22 21:15:02 +00:00
|
|
|
|
#, fuzzy
|
2023-07-23 12:39:39 +00:00
|
|
|
|
msgid "Example:"
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgstr "Par exemple ::"
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:830
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"``LiteralString`` is useful for sensitive APIs where arbitrary user-"
|
|
|
|
|
"generated strings could generate problems. For example, the two cases above "
|
|
|
|
|
"that generate type checker errors could be vulnerable to an SQL injection "
|
|
|
|
|
"attack."
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:835
|
2023-01-15 21:42:07 +00:00
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "See :pep:`675` for more details."
|
|
|
|
|
msgstr "Voir la :pep:`484` pour plus de détails."
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:841
|
2022-03-23 17:40:12 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"The `bottom type <https://en.wikipedia.org/wiki/Bottom_type>`_, a type that "
|
|
|
|
|
"has no members."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:844
|
2022-03-23 17:40:12 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"This can be used to define a function that should never be called, or a "
|
|
|
|
|
"function that never returns::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:864
|
2022-03-23 17:40:12 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"On older Python versions, :data:`NoReturn` may be used to express the same "
|
|
|
|
|
"concept. ``Never`` was added to make the intended meaning more explicit."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:869
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "Special type indicating that a function never returns."
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgstr "Type spécial indiquant qu'une fonction ne renvoie rien. Par exemple ::"
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:878
|
2022-03-23 17:40:12 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"``NoReturn`` can also be used as a `bottom type <https://en.wikipedia.org/"
|
|
|
|
|
"wiki/Bottom_type>`_, a type that has no values. Starting in Python 3.11, "
|
|
|
|
|
"the :data:`Never` type should be used for this concept instead. Type "
|
|
|
|
|
"checkers should treat the two equivalently."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:889
|
2022-03-23 17:40:12 +00:00
|
|
|
|
#, fuzzy
|
2023-07-23 12:39:39 +00:00
|
|
|
|
msgid "Special type to represent the current enclosed class."
|
2022-03-23 17:40:12 +00:00
|
|
|
|
msgstr "Type spécial indiquant qu'une fonction ne renvoie rien. Par exemple ::"
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:901
|
2022-03-23 17:40:12 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"This annotation is semantically equivalent to the following, albeit in a "
|
|
|
|
|
"more succinct fashion::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:913
|
2022-03-23 17:40:12 +00:00
|
|
|
|
msgid "In general if something currently follows the pattern of::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:920
|
2022-03-23 17:40:12 +00:00
|
|
|
|
msgid ""
|
2023-01-15 21:42:07 +00:00
|
|
|
|
"You should use :data:`Self` as calls to ``SubclassOfFoo.return_self`` would "
|
|
|
|
|
"have ``Foo`` as the return type and not ``SubclassOfFoo``."
|
2022-03-23 17:40:12 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:923
|
2022-03-23 17:40:12 +00:00
|
|
|
|
msgid "Other common use cases include:"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:925
|
2022-03-23 17:40:12 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
":class:`classmethod`\\s that are used as alternative constructors and return "
|
|
|
|
|
"instances of the ``cls`` parameter."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:927
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgid "Annotating an :meth:`~object.__enter__` method which returns self."
|
2022-03-23 17:40:12 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:929
|
2023-01-15 21:42:07 +00:00
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "See :pep:`673` for more details."
|
|
|
|
|
msgstr "Voir la :pep:`484` pour plus de détails."
|
2022-03-23 17:40:12 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:935
|
2021-09-24 08:20:01 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Special annotation for explicitly declaring a :ref:`type alias <type-"
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"aliases>`."
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:943
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"``TypeAlias`` is particularly useful for annotating aliases that make use of "
|
|
|
|
|
"forward references, as it can be hard for type checkers to distinguish these "
|
|
|
|
|
"from normal variable assignments:"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:963
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "See :pep:`613` for more details."
|
|
|
|
|
msgstr "Voir la :pep:`484` pour plus de détails."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:968
|
|
|
|
|
msgid "Special forms"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:970
|
2020-12-18 06:09:57 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"These can be used as types in annotations. They all support subscription "
|
|
|
|
|
"using ``[]``, but each has a unique syntax."
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:975
|
2021-09-24 08:20:01 +00:00
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid ""
|
|
|
|
|
"Union type; ``Union[X, Y]`` is equivalent to ``X | Y`` and means either X or "
|
|
|
|
|
"Y."
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgstr "Type « union » ; ``Union[X, Y]`` signifie X ou Y."
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:977
|
2021-09-24 08:20:01 +00:00
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid ""
|
|
|
|
|
"To define a union, use e.g. ``Union[int, str]`` or the shorthand ``int | "
|
2021-12-31 10:41:52 +00:00
|
|
|
|
"str``. Using that shorthand is recommended. Details:"
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
"Pour définir une union, utilisez par exemple ``Union[int, str]``. Détail :"
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:979
|
2020-09-11 07:11:46 +00:00
|
|
|
|
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."
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:981
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgid "Unions of unions are flattened, e.g.::"
|
|
|
|
|
msgstr "Les unions d'unions sont aplanies, par exemple ::"
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:985
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgid "Unions of a single argument vanish, e.g.::"
|
|
|
|
|
msgstr "Les unions d'un seul argument disparaissent, par exemple ::"
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:989
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgid "Redundant arguments are skipped, e.g.::"
|
|
|
|
|
msgstr "Les arguments redondants sont ignorés, par exemple ::"
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:993
|
2020-09-11 07:11:46 +00:00
|
|
|
|
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 ::"
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:997
|
2021-09-24 08:20:01 +00:00
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "You cannot subclass or instantiate a ``Union``."
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgstr "Vous ne pouvez pas sous-classer ou instancier une union."
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:999
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgid "You cannot write ``Union[X][Y]``."
|
|
|
|
|
msgstr "Vous ne pouvez pas écrire ``Union[X][Y]``."
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1001
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgid "Don't remove explicit subclasses from unions at runtime."
|
|
|
|
|
msgstr "Ne supprime pas les sous-classes explicites des unions à l'exécution."
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1004
|
2021-09-24 08:20:01 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Unions can now be written as ``X | Y``. See :ref:`union type "
|
|
|
|
|
"expressions<types-union>`."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1010
|
2021-09-24 08:20:01 +00:00
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "``Optional[X]`` is equivalent to ``X | None`` (or ``Union[X, None]``)."
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgstr "``Optional[X]`` équivaut à ``Union[X, None]``."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1012
|
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
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1020
|
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
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1027
|
2021-09-24 08:20:01 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Optional can now be written as ``X | None``. See :ref:`union type "
|
|
|
|
|
"expressions<types-union>`."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1033
|
|
|
|
|
msgid "Special form for annotating higher-order functions."
|
2021-09-24 08:20:01 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1035
|
2021-09-24 08:20:01 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"``Concatenate`` can be used in conjunction with :ref:`Callable <annotating-"
|
|
|
|
|
"callables>` and :class:`ParamSpec` to annotate a higher-order callable which "
|
|
|
|
|
"adds, removes, or transforms parameters of another callable. Usage is in "
|
|
|
|
|
"the form ``Concatenate[Arg1Type, Arg2Type, ..., ParamSpecVariable]``. "
|
|
|
|
|
"``Concatenate`` is currently only valid when used as the first argument to "
|
|
|
|
|
"a :ref:`Callable <annotating-callables>`. The last parameter to "
|
2022-05-22 21:15:02 +00:00
|
|
|
|
"``Concatenate`` must be a :class:`ParamSpec` or ellipsis (``...``)."
|
2021-09-24 08:20:01 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1044
|
2021-09-24 08:20:01 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"For example, to annotate a decorator ``with_lock`` which provides a :class:"
|
|
|
|
|
"`threading.Lock` to the decorated function, ``Concatenate`` can be used to "
|
|
|
|
|
"indicate that ``with_lock`` expects a callable which takes in a ``Lock`` as "
|
|
|
|
|
"the first argument, and returns a callable with a different type signature. "
|
|
|
|
|
"In this case, the :class:`ParamSpec` indicates that the returned callable's "
|
|
|
|
|
"parameter types are dependent on the parameter types of the callable being "
|
|
|
|
|
"passed in::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1740
|
2021-09-24 08:20:01 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
":pep:`612` -- Parameter Specification Variables (the PEP which introduced "
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"``ParamSpec`` and ``Concatenate``)"
|
2021-09-24 08:20:01 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1085
|
|
|
|
|
msgid ":class:`ParamSpec`"
|
2021-09-24 08:20:01 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1743
|
|
|
|
|
msgid ":ref:`annotating-callables`"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1090
|
|
|
|
|
msgid "Special typing form to define \"literal types\"."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1092
|
|
|
|
|
#, fuzzy
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"``Literal`` can be used to indicate to type checkers that the annotated "
|
|
|
|
|
"object has a value equivalent to one of the provided literals."
|
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
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1108
|
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
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1114
|
2020-12-18 06:09:57 +00:00
|
|
|
|
msgid ""
|
2021-05-26 17:39:06 +00:00
|
|
|
|
"``Literal`` now de-duplicates parameters. Equality comparisons of "
|
2020-12-18 06:09:57 +00:00
|
|
|
|
"``Literal`` objects are no longer order dependent. ``Literal`` objects will "
|
|
|
|
|
"now raise a :exc:`TypeError` exception during equality comparisons if one of "
|
2021-05-26 17:39:06 +00:00
|
|
|
|
"their parameters are not :term:`hashable`."
|
2020-12-18 06:09:57 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1122
|
2020-09-11 07:11:46 +00:00
|
|
|
|
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
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1124
|
2020-09-11 07:11:46 +00:00
|
|
|
|
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
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1132
|
2020-09-11 07:11:46 +00:00
|
|
|
|
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
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1134
|
2020-09-11 07:11:46 +00:00
|
|
|
|
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é "
|
2023-02-17 16:53:03 +00:00
|
|
|
|
"par des vérificateurs tiers. Par exemple, un vérificateur de types peut "
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"marquer le code suivant comme une erreur ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1148
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "Special typing construct to indicate final names to type checkers."
|
|
|
|
|
msgstr ""
|
|
|
|
|
"Construction de type particulière pour indiquer les variables de classe."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:1150
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Final names cannot be reassigned in any scope. Final names declared in class "
|
|
|
|
|
"scopes cannot be overridden in subclasses."
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgstr ""
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2540
|
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
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1171
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "Special typing construct to mark a :class:`TypedDict` key as required."
|
|
|
|
|
msgstr ""
|
|
|
|
|
"Construction de type particulière pour indiquer les variables de classe."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:1173
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid ""
|
|
|
|
|
"This is mainly useful for ``total=False`` TypedDicts. See :class:`TypedDict` "
|
|
|
|
|
"and :pep:`655` for more details."
|
|
|
|
|
msgstr "Voir la :pep:`484` pour plus de détails."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:1180
|
|
|
|
|
#, fuzzy
|
2023-01-15 21:42:07 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Special typing construct to mark a :class:`TypedDict` key as potentially "
|
|
|
|
|
"missing."
|
2023-01-15 21:42:07 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Construction de type particulière pour indiquer les variables de classe."
|
2023-01-15 21:42:07 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1183
|
2023-01-15 21:42:07 +00:00
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "See :class:`TypedDict` and :pep:`655` for more details."
|
|
|
|
|
msgstr "Voir la :pep:`484` pour plus de détails."
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1189
|
|
|
|
|
msgid "Special typing form to add context-specific metadata to an annotation."
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgstr ""
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1191
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Add metadata ``x`` to a given type ``T`` by using the annotation "
|
|
|
|
|
"``Annotated[T, x]``. Metadata added using ``Annotated`` can be used by "
|
|
|
|
|
"static analysis tools or at runtime. At runtime, the metadata is stored in "
|
|
|
|
|
"a :attr:`!__metadata__` attribute."
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgstr ""
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1196
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"If a library or tool encounters an annotation ``Annotated[T, x]`` and has no "
|
|
|
|
|
"special logic for the metadata, it should ignore the metadata and simply "
|
|
|
|
|
"treat the annotation as ``T``. As such, ``Annotated`` can be useful for code "
|
|
|
|
|
"that wants to use annotations for purposes outside Python's static typing "
|
|
|
|
|
"system."
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgstr ""
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1202
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Using ``Annotated[T, x]`` as an annotation still allows for static "
|
|
|
|
|
"typechecking of ``T``, as type checkers will simply ignore the metadata "
|
|
|
|
|
"``x``. In this way, ``Annotated`` differs from the :func:`@no_type_check "
|
|
|
|
|
"<no_type_check>` decorator, which can also be used for adding annotations "
|
|
|
|
|
"outside the scope of the typing system, but completely disables typechecking "
|
|
|
|
|
"for a function or class."
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1209
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"The responsibility of how to interpret the metadata lies with the the tool "
|
|
|
|
|
"or library encountering an ``Annotated`` annotation. A tool or library "
|
|
|
|
|
"encountering an ``Annotated`` type can scan through the metadata elements to "
|
|
|
|
|
"determine if they are of interest (e.g., using :func:`isinstance`)."
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1217
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Here is an example of how you might use ``Annotated`` to add metadata to "
|
|
|
|
|
"type annotations if you were doing range analysis:"
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1230
|
|
|
|
|
msgid "Details of the syntax:"
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1232
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgid "The first argument to ``Annotated`` must be a valid type"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1234
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Multiple metadata elements can be supplied (``Annotated`` supports variadic "
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"arguments)::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1243
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"It is up to the tool consuming the annotations to decide whether the client "
|
|
|
|
|
"is allowed to add multiple metadata elements to one annotation and how to "
|
|
|
|
|
"merge those annotations."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:1247
|
|
|
|
|
msgid ""
|
|
|
|
|
"``Annotated`` must be subscripted with at least two arguments "
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"( ``Annotated[int]`` is not valid)"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1250
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"The order of the metadata elements is preserved and matters for equality "
|
|
|
|
|
"checks::"
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1257
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Nested ``Annotated`` types are flattened. The order of the metadata elements "
|
|
|
|
|
"starts with the innermost annotation::"
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1264
|
|
|
|
|
msgid "Duplicated metadata elements are not removed::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:1270
|
|
|
|
|
msgid "``Annotated`` can be used with nested and generic aliases:"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:1283
|
|
|
|
|
msgid "``Annotated`` cannot be used with an unpacked :class:`TypeVarTuple`::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:1287
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "This would be equivalent to::"
|
|
|
|
|
msgstr "Ce qui est équivalent à ::"
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:1291
|
|
|
|
|
msgid ""
|
|
|
|
|
"where ``T1``, ``T2``, etc. are :class:`TypeVars <TypeVar>`. This would be "
|
|
|
|
|
"invalid: only one type should be passed to Annotated."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:1294
|
|
|
|
|
msgid ""
|
|
|
|
|
"By default, :func:`get_type_hints` strips the metadata from annotations. "
|
|
|
|
|
"Pass ``include_extras=True`` to have the metadata preserved:"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:1307
|
|
|
|
|
msgid ""
|
|
|
|
|
"At runtime, the metadata associated with an ``Annotated`` type can be "
|
|
|
|
|
"retrieved via the :attr:`!__metadata__` attribute:"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:1321
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid ":pep:`593` - Flexible function and variable annotations"
|
|
|
|
|
msgstr ":pep:`593`: fonction Flexible et annotations de variables"
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:1322
|
|
|
|
|
msgid "The PEP introducing ``Annotated`` to the standard library."
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1329
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "Special typing construct for marking user-defined type guard functions."
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Construction de type particulière pour indiquer les variables de classe."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1331
|
2021-09-24 08:20:01 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"``TypeGuard`` can be used to annotate the return type of a user-defined type "
|
2021-09-24 08:20:01 +00:00
|
|
|
|
"guard function. ``TypeGuard`` only accepts a single type argument. At "
|
|
|
|
|
"runtime, functions marked this way should return a boolean."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1335
|
2021-09-24 08:20:01 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"``TypeGuard`` aims to benefit *type narrowing* -- a technique used by static "
|
|
|
|
|
"type checkers to determine a more precise type of an expression within a "
|
|
|
|
|
"program's code flow. Usually type narrowing is done by analyzing "
|
|
|
|
|
"conditional code flow and applying the narrowing to a block of code. The "
|
|
|
|
|
"conditional expression here is sometimes referred to as a \"type guard\"::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1350
|
2021-09-24 08:20:01 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Sometimes it would be convenient to use a user-defined boolean function as a "
|
|
|
|
|
"type guard. Such a function should use ``TypeGuard[...]`` as its return "
|
|
|
|
|
"type to alert static type checkers to this intention."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1354
|
2021-09-24 08:20:01 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Using ``-> TypeGuard`` tells the static type checker that for a given "
|
|
|
|
|
"function:"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1357
|
2021-09-24 08:20:01 +00:00
|
|
|
|
msgid "The return value is a boolean."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1358
|
2021-09-24 08:20:01 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"If the return value is ``True``, the type of its argument is the type inside "
|
|
|
|
|
"``TypeGuard``."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1375
|
2021-09-24 08:20:01 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"If ``is_str_list`` is a class or instance method, then the type in "
|
|
|
|
|
"``TypeGuard`` maps to the type of the second parameter after ``cls`` or "
|
|
|
|
|
"``self``."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1379
|
2021-09-24 08:20:01 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"In short, the form ``def foo(arg: TypeA) -> TypeGuard[TypeB]: ...``, means "
|
|
|
|
|
"that if ``foo(arg)`` returns ``True``, then ``arg`` narrows from ``TypeA`` "
|
|
|
|
|
"to ``TypeB``."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1385
|
2021-09-24 08:20:01 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"``TypeB`` need not be a narrower form of ``TypeA`` -- it can even be a wider "
|
2022-03-23 17:40:12 +00:00
|
|
|
|
"form. The main reason is to allow for things like narrowing ``list[object]`` "
|
|
|
|
|
"to ``list[str]`` even though the latter is not a subtype of the former, "
|
|
|
|
|
"since ``list`` is invariant. The responsibility of writing type-safe type "
|
2021-09-24 08:20:01 +00:00
|
|
|
|
"guards is left to the user."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1391
|
2023-01-15 21:42:07 +00:00
|
|
|
|
#, fuzzy
|
2021-09-24 08:20:01 +00:00
|
|
|
|
msgid ""
|
2023-01-15 21:42:07 +00:00
|
|
|
|
"``TypeGuard`` also works with type variables. See :pep:`647` for more "
|
|
|
|
|
"details."
|
2021-09-24 08:20:01 +00:00
|
|
|
|
msgstr ""
|
2023-01-15 21:42:07 +00:00
|
|
|
|
"Ces propriétés ne sont pas vérifiées à l'exécution. Voir la :pep:`591` pour "
|
|
|
|
|
"plus de détails."
|
2021-09-24 08:20:01 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1398
|
|
|
|
|
msgid "Typing operator to conceptually mark an object as having been unpacked."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:1400
|
|
|
|
|
msgid ""
|
|
|
|
|
"For example, using the unpack operator ``*`` on a :class:`type variable "
|
|
|
|
|
"tuple <TypeVarTuple>` is equivalent to using ``Unpack`` to mark the type "
|
|
|
|
|
"variable tuple as having been unpacked::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:1409
|
|
|
|
|
msgid ""
|
|
|
|
|
"In fact, ``Unpack`` can be used interchangeably with ``*`` in the context "
|
|
|
|
|
"of :class:`typing.TypeVarTuple <TypeVarTuple>` and :class:`builtins.tuple "
|
|
|
|
|
"<tuple>` types. You might see ``Unpack`` being used explicitly in older "
|
|
|
|
|
"versions of Python, where ``*`` couldn't be used in certain places::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:1426
|
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"
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1428
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"The following classes should not be used directly as annotations. Their "
|
|
|
|
|
"intended purpose is to be building blocks for creating generic types."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1434
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgid "Abstract base class for generic types."
|
|
|
|
|
msgstr "Classe de base abstraite pour les types génériques."
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1436
|
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
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1445
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgid "This class can then be used as follows::"
|
|
|
|
|
msgstr "Cette classe peut alors être utilisée comme suit ::"
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1458
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgid "Type variable."
|
|
|
|
|
msgstr "Variables de type."
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1555 library/typing.rst:1779 library/typing.rst:2724
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgid "Usage::"
|
|
|
|
|
msgstr "Utilisation ::"
|
2017-04-02 20:14:06 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1466
|
2020-12-18 06:09:57 +00:00
|
|
|
|
#, fuzzy
|
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 "
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"function and type alias 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
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1487
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgid ""
|
2022-03-23 17:40:12 +00:00
|
|
|
|
"Note that type variables can be *bound*, *constrained*, or neither, but "
|
|
|
|
|
"cannot be both bound *and* constrained."
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgstr ""
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1490
|
|
|
|
|
#, fuzzy
|
|
|
|
|
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."
|
|
|
|
|
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`."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:1494
|
2022-03-23 17:40:12 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Bound type variables and constrained type variables have different semantics "
|
|
|
|
|
"in several important ways. Using a *bound* type variable means that the "
|
|
|
|
|
"``TypeVar`` will be solved using the most specific type possible::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1509
|
2022-03-23 17:40:12 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Type variables can be bound to concrete types, abstract types (ABCs or "
|
|
|
|
|
"protocols), and even unions of types::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1517
|
2022-03-23 17:40:12 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Using a *constrained* type variable, however, means that the ``TypeVar`` can "
|
|
|
|
|
"only ever be solved as being exactly one of the constraints given::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1528
|
|
|
|
|
msgid "At runtime, ``isinstance(x, T)`` will raise :exc:`TypeError`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1532
|
2022-03-23 17:40:12 +00:00
|
|
|
|
#, fuzzy
|
2023-07-23 12:39:39 +00:00
|
|
|
|
msgid "The name of the type variable."
|
|
|
|
|
msgstr "Variables de type."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:1536
|
|
|
|
|
msgid "Whether the type var has been marked as covariant."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:1540
|
|
|
|
|
msgid "Whether the type var has been marked as contravariant."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:1544
|
|
|
|
|
msgid "The bound of the type variable, if any."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:1548
|
|
|
|
|
msgid "A tuple containing the constraints of the type variable, if any."
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgstr ""
|
2017-04-02 20:14:06 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1552
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Type variable tuple. A specialized form of :class:`type variable <TypeVar>` "
|
|
|
|
|
"that enables *variadic* generics."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1563
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"A normal type variable enables parameterization with a single type. A type "
|
|
|
|
|
"variable tuple, in contrast, allows parameterization with an *arbitrary* "
|
|
|
|
|
"number of types by acting like an *arbitrary* number of type variables "
|
|
|
|
|
"wrapped in a tuple. For example::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1585
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Note the use of the unpacking operator ``*`` in ``tuple[T, *Ts]``. "
|
|
|
|
|
"Conceptually, you can think of ``Ts`` as a tuple of type variables ``(T1, "
|
|
|
|
|
"T2, ...)``. ``tuple[T, *Ts]`` would then become ``tuple[T, *(T1, "
|
|
|
|
|
"T2, ...)]``, which is equivalent to ``tuple[T, T1, T2, ...]``. (Note that in "
|
|
|
|
|
"older versions of Python, you might see this written using :data:`Unpack "
|
|
|
|
|
"<Unpack>` instead, as ``Unpack[Ts]``.)"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1593
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Type variable tuples must *always* be unpacked. This helps distinguish type "
|
2023-01-15 21:42:07 +00:00
|
|
|
|
"variable tuples from normal type variables::"
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1600
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Type variable tuples can be used in the same contexts as normal type "
|
|
|
|
|
"variables. For example, in class definitions, arguments, and return types::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1609
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Type variable tuples can be happily combined with normal type variables:"
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1628
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"However, note that at most one type variable tuple may appear in a single "
|
|
|
|
|
"list of type arguments or type parameters::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1635
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Finally, an unpacked type variable tuple can be used as the type annotation "
|
|
|
|
|
"of ``*args``::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1645
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"In contrast to non-unpacked annotations of ``*args`` - e.g. ``*args: int``, "
|
|
|
|
|
"which would specify that *all* arguments are ``int`` - ``*args: *Ts`` "
|
|
|
|
|
"enables reference to the types of the *individual* arguments in ``*args``. "
|
|
|
|
|
"Here, this allows us to ensure the types of the ``*args`` passed to "
|
|
|
|
|
"``call_soon`` match the types of the (positional) arguments of ``callback``."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1652
|
2023-01-15 21:42:07 +00:00
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "See :pep:`646` for more details on type variable tuples."
|
|
|
|
|
msgstr "Voir la :pep:`484` pour plus de détails."
|
2022-05-22 21:15:02 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1656
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "The name of the type variable tuple."
|
|
|
|
|
msgstr "Voir la :pep:`484` pour plus de détails."
|
2022-05-22 21:15:02 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1662
|
2021-09-24 08:20:01 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Parameter specification variable. A specialized version of :class:`type "
|
|
|
|
|
"variables <TypeVar>`."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1669
|
2021-09-24 08:20:01 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Parameter specification variables exist primarily for the benefit of static "
|
|
|
|
|
"type checkers. They are used to forward the parameter types of one callable "
|
|
|
|
|
"to another callable -- a pattern commonly found in higher order functions "
|
|
|
|
|
"and decorators. They are only valid when used in ``Concatenate``, or as the "
|
|
|
|
|
"first argument to ``Callable``, or as parameters for user-defined Generics. "
|
|
|
|
|
"See :class:`Generic` for more information on generic types."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1676
|
2021-09-24 08:20:01 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"For example, to add basic logging to a function, one can create a decorator "
|
|
|
|
|
"``add_logging`` to log function calls. The parameter specification variable "
|
|
|
|
|
"tells the type checker that the callable passed into the decorator and the "
|
|
|
|
|
"new callable returned by it have inter-dependent type parameters::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1700
|
2021-09-24 08:20:01 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Without ``ParamSpec``, the simplest way to annotate this previously was to "
|
|
|
|
|
"use a :class:`TypeVar` with bound ``Callable[..., Any]``. However this "
|
|
|
|
|
"causes two problems:"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1704
|
2021-09-24 08:20:01 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"The type checker can't type check the ``inner`` function because ``*args`` "
|
|
|
|
|
"and ``**kwargs`` have to be typed :data:`Any`."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1706
|
2021-09-24 08:20:01 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
":func:`~cast` may be required in the body of the ``add_logging`` decorator "
|
|
|
|
|
"when returning the ``inner`` function, or the static type checker must be "
|
|
|
|
|
"told to ignore the ``return inner``."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1713
|
2021-09-24 08:20:01 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Since ``ParamSpec`` captures both positional and keyword parameters, ``P."
|
|
|
|
|
"args`` and ``P.kwargs`` can be used to split a ``ParamSpec`` into its "
|
|
|
|
|
"components. ``P.args`` represents the tuple of positional parameters in a "
|
|
|
|
|
"given call and should only be used to annotate ``*args``. ``P.kwargs`` "
|
|
|
|
|
"represents the mapping of keyword parameters to their values in a given "
|
|
|
|
|
"call, and should be only be used to annotate ``**kwargs``. Both attributes "
|
|
|
|
|
"require the annotated parameter to be in scope. At runtime, ``P.args`` and "
|
|
|
|
|
"``P.kwargs`` are instances respectively of :class:`ParamSpecArgs` and :class:"
|
|
|
|
|
"`ParamSpecKwargs`."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1725
|
|
|
|
|
msgid "The name of the parameter specification."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:1727
|
2021-09-24 08:20:01 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Parameter specification variables created with ``covariant=True`` or "
|
|
|
|
|
"``contravariant=True`` can be used to declare covariant or contravariant "
|
|
|
|
|
"generic types. The ``bound`` argument is also accepted, similar to :class:"
|
|
|
|
|
"`TypeVar`. However the actual semantics of these keywords are yet to be "
|
|
|
|
|
"decided."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1736
|
2021-09-24 08:20:01 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Only parameter specification variables defined in global scope can be "
|
|
|
|
|
"pickled."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1742
|
|
|
|
|
msgid ":data:`Concatenate`"
|
2021-09-24 08:20:01 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1748
|
2021-09-24 08:20:01 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Arguments and keyword arguments attributes of a :class:`ParamSpec`. The ``P."
|
|
|
|
|
"args`` attribute of a ``ParamSpec`` is an instance of ``ParamSpecArgs``, and "
|
|
|
|
|
"``P.kwargs`` is an instance of ``ParamSpecKwargs``. They are intended for "
|
|
|
|
|
"runtime introspection and have no special meaning to static type checkers."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1753
|
2021-09-24 08:20:01 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Calling :func:`get_origin` on either of these objects will return the "
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"original ``ParamSpec``:"
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgstr ""
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1769
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgid "Other special directives"
|
|
|
|
|
msgstr ""
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1771
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"These functions and classes should not be used directly as annotations. "
|
|
|
|
|
"Their intended purpose is to be building blocks for creating and declaring "
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"types."
|
|
|
|
|
msgstr ""
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1777
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgid "Typed version of :func:`collections.namedtuple`."
|
|
|
|
|
msgstr "Version typée de :func:`collections.namedtuple`."
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1785
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgid "This is equivalent to::"
|
|
|
|
|
msgstr "Ce qui est équivalent à ::"
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1789
|
2020-09-11 07:11:46 +00:00
|
|
|
|
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 ::"
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1798
|
2020-09-11 07:11:46 +00:00
|
|
|
|
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."
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1800
|
2022-05-22 21:15:02 +00:00
|
|
|
|
#, fuzzy
|
2020-09-11 07:11:46 +00:00
|
|
|
|
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`` "
|
2022-05-22 21:15:02 +00:00
|
|
|
|
"attribute, both of which are part of the :func:`~collections.namedtuple` "
|
|
|
|
|
"API.)"
|
2020-09-11 07:11:46 +00:00
|
|
|
|
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*.)"
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1806
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgid "``NamedTuple`` subclasses can also have docstrings and methods::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
"Les sous-classes de ``NamedTuple`` peuvent aussi avoir des *docstrings* et "
|
|
|
|
|
"des méthodes ::"
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1816
|
2022-05-22 21:15:02 +00:00
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "``NamedTuple`` subclasses can be generic::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
"Les sous-classes de ``NamedTuple`` peuvent aussi avoir des *docstrings* et "
|
|
|
|
|
"des méthodes ::"
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1822
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgid "Backward-compatible usage::"
|
|
|
|
|
msgstr "Utilisation rétrocompatible ::"
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1826
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgid "Added support for :pep:`526` variable annotation syntax."
|
|
|
|
|
msgstr ""
|
|
|
|
|
"Ajout de la gestion de la syntaxe d'annotation variable de la :pep:`526`."
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1829
|
2020-09-11 07:11:46 +00:00
|
|
|
|
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*."
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1832
|
2020-09-11 07:11:46 +00:00
|
|
|
|
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``."
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1836
|
2020-09-11 07:11:46 +00:00
|
|
|
|
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."
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1840
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgid "Added support for generic namedtuples."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1845
|
|
|
|
|
msgid "Helper class to create low-overhead :ref:`distinct types <distinct>`."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:1847
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"A ``NewType`` is considered a distinct type by a typechecker. At runtime, "
|
|
|
|
|
"however, calling a ``NewType`` returns its argument unchanged."
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
"Une fonction pour faciliter l'indication d'un type distinct à un "
|
2023-02-17 16:53:03 +00:00
|
|
|
|
"vérificateur de types, voir :ref:`distinct`. Lors de l'exécution, elle "
|
2020-09-11 07:11:46 +00:00
|
|
|
|
"renvoie une fonction qui renvoie son argument. Utilisation ::"
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1857
|
|
|
|
|
msgid "The module in which the new type is defined."
|
2021-09-24 08:20:01 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1861
|
|
|
|
|
msgid "The name of the new type."
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1865
|
|
|
|
|
msgid "The type that the new type is based on."
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1869
|
|
|
|
|
msgid "``NewType`` is now a class rather than a function."
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1874
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "Base class for protocol classes."
|
2022-03-23 17:40:12 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Classe de base pour les classes de protocole. Les classes de protocole sont "
|
|
|
|
|
"définies comme suit ::"
|
2022-03-23 17:40:12 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1876
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "Protocol classes are defined like this::"
|
2022-03-23 17:40:12 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Classe de base pour les classes de protocole. Les classes de protocole sont "
|
|
|
|
|
"définies comme suit ::"
|
2022-03-23 17:40:12 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1882
|
2022-03-23 17:40:12 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"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 ::"
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:1894
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid ""
|
|
|
|
|
"See :pep:`544` for more 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:1899
|
|
|
|
|
msgid "Protocol classes can be generic, for example::"
|
|
|
|
|
msgstr "Les classes de protocole peuvent être génériques, par exemple ::"
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:1911
|
|
|
|
|
msgid "Mark a protocol class as a runtime protocol."
|
|
|
|
|
msgstr "Marquez une classe de protocole comme protocole d'exécution."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:1913
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid ""
|
|
|
|
|
"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:`~collections.abc."
|
|
|
|
|
"Iterable`. For example::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
"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 ::"
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:1933
|
|
|
|
|
msgid ""
|
|
|
|
|
":func:`!runtime_checkable` will check only the presence of the required "
|
|
|
|
|
"methods or attributes, not their type signatures or types. For example, :"
|
|
|
|
|
"class:`ssl.SSLObject` is a class, therefore it passes an :func:`issubclass` "
|
|
|
|
|
"check against :ref:`Callable <annotating-callables>`. However, the ``ssl."
|
|
|
|
|
"SSLObject.__init__`` method exists only to raise a :exc:`TypeError` with a "
|
|
|
|
|
"more informative message, therefore making it impossible to call "
|
|
|
|
|
"(instantiate) :class:`ssl.SSLObject`."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:1944
|
|
|
|
|
msgid ""
|
|
|
|
|
"An :func:`isinstance` check against a runtime-checkable protocol can be "
|
|
|
|
|
"surprisingly slow compared to an ``isinstance()`` check against a non-"
|
|
|
|
|
"protocol class. Consider using alternative idioms such as :func:`hasattr` "
|
|
|
|
|
"calls for structural checks in performance-sensitive code."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:1955
|
|
|
|
|
#, 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:1958
|
|
|
|
|
#, 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:1974
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid ""
|
|
|
|
|
"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:1978
|
|
|
|
|
msgid "Using a literal :class:`dict` as the second argument::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:1982
|
|
|
|
|
msgid "Using keyword arguments::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:1989
|
|
|
|
|
msgid ""
|
|
|
|
|
"The keyword-argument syntax is deprecated in 3.11 and will be removed in "
|
|
|
|
|
"3.13. It may also be unsupported by static type checkers."
|
2022-03-23 17:40:12 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:1990
|
2022-03-23 17:40:12 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"The functional syntax should also be used when any of the keys are not "
|
2022-05-22 21:15:02 +00:00
|
|
|
|
"valid :ref:`identifiers <identifiers>`, for example because they are "
|
|
|
|
|
"keywords or contain hyphens. Example::"
|
2022-03-23 17:40:12 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2002
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgid ""
|
2021-09-24 08:20:01 +00:00
|
|
|
|
"By default, all keys must be present in a ``TypedDict``. It is possible to "
|
2023-01-15 21:42:07 +00:00
|
|
|
|
"mark individual keys as non-required using :data:`NotRequired`::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2013
|
2023-01-15 21:42:07 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"This means that a ``Point2D`` ``TypedDict`` can have the ``label`` key "
|
|
|
|
|
"omitted."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2016
|
2023-01-15 21:42:07 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"It is also possible to mark all keys as non-required by default by "
|
|
|
|
|
"specifying a totality of ``False``::"
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2026
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgid ""
|
2021-09-24 08:20:01 +00:00
|
|
|
|
"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 required."
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2031
|
2023-01-15 21:42:07 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Individual keys of a ``total=False`` ``TypedDict`` can be marked as required "
|
|
|
|
|
"using :data:`Required`::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2046
|
2022-03-23 17:40:12 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"It is possible for a ``TypedDict`` type to inherit from one or more other "
|
|
|
|
|
"``TypedDict`` types using the class-based syntax. Usage::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2053
|
2022-03-23 17:40:12 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"``Point3D`` has three items: ``x``, ``y`` and ``z``. It is equivalent to "
|
|
|
|
|
"this definition::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2061
|
2022-03-23 17:40:12 +00:00
|
|
|
|
msgid ""
|
2022-05-22 21:15:02 +00:00
|
|
|
|
"A ``TypedDict`` cannot inherit from a non-\\ ``TypedDict`` class, except "
|
|
|
|
|
"for :class:`Generic`. For example::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2079
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "A ``TypedDict`` can be generic:"
|
2022-03-23 17:40:12 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Les sous-classes de ``NamedTuple`` peuvent aussi avoir des *docstrings* et "
|
|
|
|
|
"des méthodes ::"
|
2022-03-23 17:40:12 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2089
|
2022-03-23 17:40:12 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"A ``TypedDict`` can be introspected via annotations dicts (see :ref:"
|
|
|
|
|
"`annotations-howto` for more information on annotations best practices), :"
|
|
|
|
|
"attr:`__total__`, :attr:`__required_keys__`, and :attr:`__optional_keys__`."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2095
|
2022-03-23 17:40:12 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"``Point2D.__total__`` gives the value of the ``total`` argument. Example:"
|
2022-03-23 17:40:12 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2117
|
2022-03-23 17:40:12 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"``Point2D.__required_keys__`` and ``Point2D.__optional_keys__`` return :"
|
|
|
|
|
"class:`frozenset` objects containing required and non-required keys, "
|
2023-01-15 21:42:07 +00:00
|
|
|
|
"respectively."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2120
|
2023-01-15 21:42:07 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Keys marked with :data:`Required` will always appear in "
|
|
|
|
|
"``__required_keys__`` and keys marked with :data:`NotRequired` will always "
|
|
|
|
|
"appear in ``__optional_keys__``."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2123
|
2023-01-15 21:42:07 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"For backwards compatibility with Python 3.10 and below, it is also possible "
|
|
|
|
|
"to use inheritance to declare both required and non-required keys in the "
|
|
|
|
|
"same ``TypedDict`` . This is done by declaring a ``TypedDict`` with one "
|
|
|
|
|
"value for the ``total`` argument and then inheriting from it in another "
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"``TypedDict`` with a different value for ``total``:"
|
2022-03-23 17:40:12 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2146
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#, 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."
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2150
|
2023-01-15 21:42:07 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"Added support for marking individual keys as :data:`Required` or :data:"
|
|
|
|
|
"`NotRequired`. See :pep:`655`."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2154
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgid "Added support for generic ``TypedDict``\\ s."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2158
|
|
|
|
|
msgid "Protocols"
|
|
|
|
|
msgstr "Protocoles"
|
2019-01-04 23:29:24 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2160
|
2023-01-15 21:42:07 +00:00
|
|
|
|
#, fuzzy
|
2020-12-18 06:09:57 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"The following protocols are provided by the typing module. All are decorated "
|
|
|
|
|
"with :func:`@runtime_checkable <runtime_checkable>`."
|
|
|
|
|
msgstr "Ces protocoles sont décorés par :func:`runtime_checkable`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2165
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"An ABC with one abstract method ``__abs__`` that is covariant in its return "
|
|
|
|
|
"type."
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Une ABC avec une méthode abstraite ``__abs__`` qui est covariante dans son "
|
|
|
|
|
"type de retour."
|
2017-05-27 17:46:38 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2170
|
|
|
|
|
msgid "An ABC with one abstract method ``__bytes__``."
|
|
|
|
|
msgstr "Une ABC avec une méthode abstraite ``__bytes__``."
|
2017-05-27 17:46:38 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2174
|
|
|
|
|
msgid "An ABC with one abstract method ``__complex__``."
|
|
|
|
|
msgstr "Une ABC avec une méthode abstraite ``__complex__``."
|
2018-12-24 13:20:55 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2178
|
|
|
|
|
msgid "An ABC with one abstract method ``__float__``."
|
|
|
|
|
msgstr "Une ABC avec une méthode abstraite ``__float__``."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2182
|
|
|
|
|
msgid "An ABC with one abstract method ``__index__``."
|
|
|
|
|
msgstr "Une ABC avec une méthode abstraite ``__index__``."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2188
|
|
|
|
|
msgid "An ABC with one abstract method ``__int__``."
|
|
|
|
|
msgstr "Une ABC avec une méthode abstraite ``__int__``."
|
2020-09-11 07:11:46 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2192
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +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 ""
|
2023-07-23 12:39:39 +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
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2196
|
|
|
|
|
msgid "ABCs for working with IO"
|
2017-04-02 20:14:06 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2202
|
2023-01-15 21:42:07 +00:00
|
|
|
|
#, fuzzy
|
2020-12-18 06:09:57 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39: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 "
|
|
|
|
|
"by :func:`open`."
|
2021-05-19 20:32:24 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +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`."
|
2020-09-11 07:11:46 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2208
|
2023-01-15 21:42:07 +00:00
|
|
|
|
#, fuzzy
|
2023-07-23 12:39:39 +00:00
|
|
|
|
msgid "Functions and decorators"
|
|
|
|
|
msgstr "Classes, fonctions et décorateurs"
|
2020-09-11 07:11:46 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2212
|
|
|
|
|
msgid "Cast a value to a type."
|
|
|
|
|
msgstr "Convertit une valeur en un type."
|
2020-09-11 07:11:46 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2214
|
2020-12-18 06:09:57 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +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)."
|
2021-05-19 20:32:24 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Ceci renvoie la valeur inchangée. Pour le vérificateur de types, 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)."
|
2017-04-02 20:14:06 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2221
|
|
|
|
|
msgid ""
|
|
|
|
|
"Ask a static type checker to confirm that *val* has an inferred type of "
|
|
|
|
|
"*typ*."
|
|
|
|
|
msgstr "Vérifie que *val* est bien du type *typ*."
|
2020-09-11 07:11:46 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2223
|
2023-01-15 21:42:07 +00:00
|
|
|
|
#, fuzzy
|
2020-12-18 06:09:57 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"At runtime this does nothing: it returns the first argument unchanged with "
|
|
|
|
|
"no checks or side effects, no matter the actual type of the argument."
|
|
|
|
|
msgstr "Renvoie le premier argument inchangé lors de l'exécution."
|
2020-09-11 07:11:46 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2226
|
2023-01-15 21:42:07 +00:00
|
|
|
|
#, fuzzy
|
2020-12-18 06:09:57 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"When a static type checker encounters a call to ``assert_type()``, it emits "
|
|
|
|
|
"an error if the value is not of the specified type::"
|
2021-05-19 20:32:24 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Lors d'un appel à ``assert_type()``, le vérificateur de types va lever "
|
|
|
|
|
"émettre une erreur si la variable n'est pas du type renseigné ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2233
|
|
|
|
|
msgid ""
|
|
|
|
|
"This function is useful for ensuring the type checker's understanding of a "
|
|
|
|
|
"script is in line with the developer's intentions::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Cette fonction permet de s'assurer de la compréhension du vérificateur de "
|
|
|
|
|
"type d'un script par rapport aux intentions du développeur ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2247
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Ask a static type checker to confirm that a line of code is unreachable."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Demande une confirmation de la part du vérificateur statique de type qu'une "
|
|
|
|
|
"ligne de code est inaccessible."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:2249
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "Example::"
|
|
|
|
|
msgstr "Par exemple ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2260
|
2021-06-22 08:04:42 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Here, the annotations allow the type checker to infer that the last case can "
|
|
|
|
|
"never execute, because ``arg`` is either an :class:`int` or a :class:`str`, "
|
|
|
|
|
"and both options are covered by earlier cases."
|
2021-06-22 08:04:42 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2265
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#, fuzzy
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"If a type checker finds that a call to ``assert_never()`` is reachable, it "
|
|
|
|
|
"will emit an error. For example, if the type annotation for ``arg`` was "
|
|
|
|
|
"instead ``int | str | float``, the type checker would emit an error pointing "
|
|
|
|
|
"out that ``unreachable`` is of type :class:`float`. For a call to "
|
|
|
|
|
"``assert_never`` to pass type checking, the inferred type of the argument "
|
|
|
|
|
"passed in must be the bottom type, :data:`Never`, and nothing else."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Les annotations permettent ici au vérificateur de types de déduire que le "
|
|
|
|
|
"dernier cas ne sera jamais exécuté car les seuls cas possibles (qu'``arg`` "
|
|
|
|
|
"soit un :class:`int` ou un :class:`str`) sont couverts dans les cas "
|
|
|
|
|
"précédents. Une erreur est levée si un appel à ``assert_never()`` est "
|
|
|
|
|
"atteignable. Par exemple, si l'annotation de type d'``arg`` est ``int | str "
|
|
|
|
|
"| float``, une erreur sera levée indiquant qu'``unreachable`` est de type :"
|
|
|
|
|
"class:`float`. Lors d'un appel à ``assert_never``, afin de passer la "
|
|
|
|
|
"vérification de type avec succès, le type déduit de l'argument doit être de "
|
|
|
|
|
"type :data:`Never`."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:2273
|
|
|
|
|
msgid "At runtime, this throws an exception when called."
|
|
|
|
|
msgstr "Une erreur est levé si la fonction est appelé lors de l'exécution."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2276
|
2021-06-22 08:04:42 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"`Unreachable Code and Exhaustiveness Checking <https://typing.readthedocs.io/"
|
|
|
|
|
"en/latest/source/unreachable.html>`__ has more information about "
|
|
|
|
|
"exhaustiveness checking with static typing."
|
2021-06-22 08:04:42 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"`Unreachable Code and Exhaustiveness Checking <https://typing.readthedocs.io/"
|
|
|
|
|
"en/latest/source/unreachable.html>`__ pour plus détails sur la vérification "
|
|
|
|
|
"exhaustive statique de type."
|
2021-06-22 08:04:42 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2284
|
|
|
|
|
msgid "Reveal the inferred static type of an expression."
|
|
|
|
|
msgstr "Révèle le type statique déduit d'une expression."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:2286
|
2017-04-02 20:14:06 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"When a static type checker encounters a call to this function, it emits a "
|
|
|
|
|
"diagnostic with the type of the argument. For example::"
|
2017-04-02 20:14:06 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Lorsqu'un vérificateur de types rencontre un appel à cette fonction, il va "
|
|
|
|
|
"diagnostiquer le type de l'argument. Par exemple ::"
|
2017-04-02 20:14:06 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2292
|
2017-04-02 20:14:06 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"This can be useful when you want to debug how your type checker handles a "
|
|
|
|
|
"particular piece of code."
|
2017-04-02 20:14:06 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Cela est utile afin de comprendre comment le vérificateur de types va "
|
|
|
|
|
"traiter un bout de code précis."
|
2017-04-02 20:14:06 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2295
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"The function returns its argument unchanged, which allows using it within an "
|
|
|
|
|
"expression::"
|
2017-05-27 17:46:38 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"La fonction renvoie l'argument inchangé. Ce qui permet de l'utiliser au sein "
|
|
|
|
|
"d'une expression ::"
|
2017-05-27 17:46:38 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2300
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Most type checkers support ``reveal_type()`` anywhere, even if the name is "
|
|
|
|
|
"not imported from ``typing``. Importing the name from ``typing`` allows your "
|
|
|
|
|
"code to run without runtime errors and communicates intent more clearly."
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"La plupart des vérificateurs de type supportent ``reveal_type()``, même dans "
|
|
|
|
|
"le cas ou le nom du type n'est pas importé depuis ``typing``. Cependant, "
|
|
|
|
|
"l'import depuis ``typing`` permet d'éviter les erreurs d'exécution et "
|
|
|
|
|
"devient plus compréhensible."
|
2022-05-22 21:15:02 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2305
|
|
|
|
|
msgid ""
|
|
|
|
|
"At runtime, this function prints the runtime type of its argument to stderr "
|
|
|
|
|
"and returns it unchanged::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
"Lors de l'exécution, cette fonction affiche le type de son argument dans "
|
|
|
|
|
"*stderr* et le renvoie inchangé ::"
|
2017-04-02 20:14:06 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2317
|
|
|
|
|
msgid ""
|
|
|
|
|
"Decorator to mark an object as providing :func:`dataclass <dataclasses."
|
|
|
|
|
"dataclass>`-like behavior."
|
|
|
|
|
msgstr ""
|
2017-04-02 20:14:06 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2320
|
2023-01-15 21:42:07 +00:00
|
|
|
|
#, fuzzy
|
2020-12-18 06:09:57 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"``dataclass_transform`` may be used to decorate a class, metaclass, or a "
|
|
|
|
|
"function that is itself a decorator. The presence of "
|
|
|
|
|
"``@dataclass_transform()`` tells a static type checker that the decorated "
|
|
|
|
|
"object performs runtime \"magic\" that transforms a class in a similar way "
|
|
|
|
|
"to :func:`@dataclasses.dataclass <dataclasses.dataclass>`."
|
2021-05-19 20:32:24 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
":data:`~typing.dataclass_transform` permet de décorer une classe, une "
|
|
|
|
|
"métaclasse ou une fonction décoratrice. L'utilisation de "
|
|
|
|
|
"``@dataclass_transform()`` avertit le vérificateur de types statiques que "
|
|
|
|
|
"l'objet décoré effectue de la \"magie\" consistant à transformer une classe, "
|
|
|
|
|
"lui appliquant un comportement du type de :func:`dataclasses.dataclass`."
|
2020-09-11 07:11:46 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2327
|
2020-07-20 08:56:42 +00:00
|
|
|
|
#, fuzzy
|
2023-07-23 12:39:39 +00:00
|
|
|
|
msgid "Example usage with a decorator function:"
|
|
|
|
|
msgstr "Exemple d'utilisation avec une fonction décoratrice ::"
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:2343
|
|
|
|
|
msgid "On a base class::"
|
|
|
|
|
msgstr "Avec une classe de base ::"
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:2352
|
|
|
|
|
msgid "On a metaclass::"
|
|
|
|
|
msgstr "Avec une métaclasse ::"
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:2363
|
2020-07-20 08:56:42 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"The ``CustomerModel`` classes defined above will be treated by type checkers "
|
|
|
|
|
"similarly to classes created with :func:`@dataclasses.dataclass <dataclasses."
|
|
|
|
|
"dataclass>`. For example, type checkers will assume these classes have "
|
|
|
|
|
"``__init__`` methods that accept ``id`` and ``name``."
|
2020-07-20 08:56:42 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Les classes ``CustomerModel`` définis ci-dessus sont traitées par les "
|
|
|
|
|
"vérificateurs de type de la même que les classes créées avec :func:"
|
|
|
|
|
"`@dataclasses.dataclass <dataclasses.dataclass>`. Par exemple, les "
|
|
|
|
|
"vérificateurs de type déduisent que ces classes possèdent une méthode "
|
|
|
|
|
"``__init__`` acceptant ``id`` et ``name`` comme arguments."
|
2020-07-20 08:56:42 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2369
|
2019-09-04 09:35:23 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"The decorated class, metaclass, or function may accept the following bool "
|
|
|
|
|
"arguments which type checkers will assume have the same effect as they would "
|
|
|
|
|
"have on the :func:`@dataclasses.dataclass<dataclasses.dataclass>` decorator: "
|
|
|
|
|
"``init``, ``eq``, ``order``, ``unsafe_hash``, ``frozen``, ``match_args``, "
|
|
|
|
|
"``kw_only``, and ``slots``. It must be possible for the value of these "
|
|
|
|
|
"arguments (``True`` or ``False``) to be statically evaluated."
|
2019-09-04 09:35:23 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Les arguments booléens suivants sont acceptés,les vérificateurs de type "
|
|
|
|
|
"supposent qu'ils ont le même effet qu'ils auraient eu sur le décorateur :"
|
|
|
|
|
"func:`@dataclasses.dataclass<dataclasses.dataclass>` : ``init``, ``eq``, "
|
|
|
|
|
"``order``, ``unsafe_hash``, ``frozen``, ``match_args``, ``kw_only``, et "
|
|
|
|
|
"``slots``. Il est possible d'évaluer statiquement les valeurs de ces "
|
|
|
|
|
"arguments (``True`` or ``False``)."
|
2019-09-04 09:35:23 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2377
|
2019-09-04 09:35:23 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"The arguments to the ``dataclass_transform`` decorator can be used to "
|
|
|
|
|
"customize the default behaviors of the decorated class, metaclass, or "
|
|
|
|
|
"function:"
|
2021-05-19 20:32:24 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Les arguments du décorateur ``dataclass_transform`` permettent de "
|
|
|
|
|
"personnaliser le comportement par défaut de la classe, métaclasse ou "
|
|
|
|
|
"fonction décorée :"
|
2019-09-04 09:35:23 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:0
|
|
|
|
|
msgid "Parameters"
|
|
|
|
|
msgstr ""
|
2019-09-04 09:35:23 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2381
|
2023-01-15 21:42:07 +00:00
|
|
|
|
#, fuzzy
|
2019-09-04 09:35:23 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Indicates whether the ``eq`` parameter is assumed to be ``True`` or "
|
|
|
|
|
"``False`` if it is omitted by the caller. Defaults to ``True``."
|
2021-05-19 20:32:24 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"``eq_default`` indique la valeur du paramètre ``eq`` (``True`` ou ``False``) "
|
|
|
|
|
"si ce ne n'est pas précisé lors de l'appel."
|
2020-05-24 14:31:50 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2386
|
2023-01-15 21:42:07 +00:00
|
|
|
|
#, fuzzy
|
2020-12-18 06:09:57 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Indicates whether the ``order`` parameter is assumed to be ``True`` or "
|
|
|
|
|
"``False`` if it is omitted by the caller. Defaults to ``False``."
|
2021-05-19 20:32:24 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"``eq_default`` indique la valeur du paramètre ``eq`` (``True`` ou ``False``) "
|
|
|
|
|
"si ce ne n'est pas précisé lors de l'appel."
|
2019-06-19 20:35:23 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2391
|
2023-01-15 21:42:07 +00:00
|
|
|
|
#, fuzzy
|
2020-12-18 06:09:57 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Indicates whether the ``kw_only`` parameter is assumed to be ``True`` or "
|
|
|
|
|
"``False`` if it is omitted by the caller. Defaults to ``False``."
|
2021-05-19 20:32:24 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"``eq_default`` indique la valeur du paramètre ``eq`` (``True`` ou ``False``) "
|
|
|
|
|
"si ce ne n'est pas précisé lors de l'appel."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2396
|
2023-01-15 21:42:07 +00:00
|
|
|
|
#, fuzzy
|
2020-12-18 06:09:57 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Specifies a static list of supported classes or functions that describe "
|
|
|
|
|
"fields, similar to :func:`dataclasses.field`. Defaults to ``()``."
|
2021-05-19 20:32:24 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"``field_specifiers`` spécifie une liste statique des classes ou fonctions "
|
|
|
|
|
"prises en charge pour la description des champs, similaire à ``dataclasses."
|
|
|
|
|
"field()``."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2402
|
2017-04-02 20:14:06 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Arbitrary other keyword arguments are accepted in order to allow for "
|
|
|
|
|
"possible future extensions."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"D'autres arguments sont acceptés afin d'autoriser de futurs possibles "
|
|
|
|
|
"extensions."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2406
|
2023-01-15 21:42:07 +00:00
|
|
|
|
#, fuzzy
|
2020-12-18 06:09:57 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Type checkers recognize the following optional parameters on field "
|
|
|
|
|
"specifiers:"
|
2021-05-19 20:32:24 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Les arguments optionnels suivants pour la spécifications des champs sont "
|
|
|
|
|
"reconnus :"
|
2020-09-11 07:11:46 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2409
|
|
|
|
|
msgid "**Recognised parameters for field specifiers**"
|
2021-05-19 20:32:24 +00:00
|
|
|
|
msgstr ""
|
2020-07-20 08:56:42 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2413
|
|
|
|
|
msgid "Parameter name"
|
|
|
|
|
msgstr ""
|
2020-07-20 08:56:42 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2414
|
|
|
|
|
msgid "Description"
|
2021-05-19 20:32:24 +00:00
|
|
|
|
msgstr ""
|
2019-09-04 09:35:23 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2415
|
|
|
|
|
msgid "``init``"
|
|
|
|
|
msgstr ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2416
|
2023-01-15 21:42:07 +00:00
|
|
|
|
#, fuzzy
|
2019-09-04 09:35:23 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Indicates whether the field should be included in the synthesized "
|
|
|
|
|
"``__init__`` method. If unspecified, ``init`` defaults to ``True``."
|
2021-05-19 20:32:24 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"``init`` indique si le champ doit être inclut au sein de la méthode "
|
|
|
|
|
"``__init__``. Vaut ``True`` par défaut."
|
2019-09-04 09:35:23 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2419
|
|
|
|
|
msgid "``default``"
|
|
|
|
|
msgstr ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2420
|
2023-01-15 21:42:07 +00:00
|
|
|
|
#, fuzzy
|
2023-07-23 12:39:39 +00:00
|
|
|
|
msgid "Provides the default value for the field."
|
|
|
|
|
msgstr "``default`` indique la valeur par défaut du champ."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2421
|
|
|
|
|
msgid "``default_factory``"
|
|
|
|
|
msgstr ""
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2422
|
2023-01-15 21:42:07 +00:00
|
|
|
|
#, fuzzy
|
2020-12-18 06:09:57 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Provides a runtime callback that returns the default value for the field. If "
|
|
|
|
|
"neither ``default`` nor ``default_factory`` are specified, the field is "
|
|
|
|
|
"assumed to have no default value and must be provided a value when the class "
|
|
|
|
|
"is instantiated."
|
2021-05-19 20:32:24 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"``default_factory`` fournit une fonction de rappel renvoyant la valeur par "
|
|
|
|
|
"défaut du champ. Si les arguments ``default`` et ``default_factory`` ne sont "
|
|
|
|
|
"pas renseignés, le champ n'a pas de valeur pas défaut et il faudra en "
|
|
|
|
|
"fournir une lors de l'instanciation de la classe."
|
2020-09-11 07:11:46 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2427
|
|
|
|
|
msgid "``factory``"
|
2021-05-19 20:32:24 +00:00
|
|
|
|
msgstr ""
|
2019-09-04 09:35:23 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2428
|
|
|
|
|
msgid "An alias for the ``default_factory`` parameter on field specifiers."
|
|
|
|
|
msgstr ""
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2429
|
|
|
|
|
msgid "``kw_only``"
|
|
|
|
|
msgstr ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2430
|
2023-01-15 21:42:07 +00:00
|
|
|
|
#, fuzzy
|
2020-12-18 06:09:57 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Indicates whether the field should be marked as keyword-only. If ``True``, "
|
|
|
|
|
"the field will be keyword-only. If ``False``, it will not be keyword-only. "
|
|
|
|
|
"If unspecified, the value of the ``kw_only`` parameter on the object "
|
|
|
|
|
"decorated with ``dataclass_transform`` will be used, or if that is "
|
|
|
|
|
"unspecified, the value of ``kw_only_default`` on ``dataclass_transform`` "
|
|
|
|
|
"will be used."
|
2021-05-19 20:32:24 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"``kw_only`` indique si le champ est uniquement par mot-clé. Si l'argument "
|
|
|
|
|
"n'est pas renseigné, la valeur du paramètre ``kw_only`` de l'objet décoré "
|
|
|
|
|
"avec ``dataclass_transform`` est utilisé. Ou si cette valeur n'est pas "
|
|
|
|
|
"renseigné non plus, la valeur de ``kw_only_default`` de "
|
|
|
|
|
"``dataclass_transform`` est utilisé."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2436
|
|
|
|
|
msgid "``alias``"
|
|
|
|
|
msgstr ""
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2437
|
2023-01-15 21:42:07 +00:00
|
|
|
|
#, fuzzy
|
2020-12-18 06:09:57 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Provides an alternative name for the field. This alternative name is used in "
|
|
|
|
|
"the synthesized ``__init__`` method."
|
2021-05-19 20:32:24 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"``alias`` indique un nom alternatif pour le champ. Cet alias est utilisé "
|
|
|
|
|
"dans le méthode ``__init__`` synthétisée."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2440
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"At runtime, this decorator records its arguments in the "
|
|
|
|
|
"``__dataclass_transform__`` attribute on the decorated object. It has no "
|
|
|
|
|
"other runtime effect."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Lors de l'exécution, les arguments de ce décorateur sont enregistrés au sein "
|
|
|
|
|
"de l'attribut ``__dataclass_transform__`` de l'objet décoré. Il n'y pas "
|
|
|
|
|
"d'autre effet à l'exécution."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2444
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "See :pep:`681` for more details."
|
|
|
|
|
msgstr "Voir la :pep:`484` pour plus de détails."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:2450
|
|
|
|
|
msgid "Decorator for creating overloaded functions and methods."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2452
|
2019-05-23 16:59:19 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +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)."
|
2019-05-23 16:59:19 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2457
|
|
|
|
|
#, fuzzy
|
2019-05-23 16:59:19 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"``@overload``-decorated definitions are for the benefit of the type checker "
|
|
|
|
|
"only, since they will be overwritten by the non-``@overload``-decorated "
|
|
|
|
|
"definition. The non-``@overload``-decorated definition, meanwhile, will be "
|
|
|
|
|
"used at runtime but should be ignored by a type checker. At runtime, "
|
|
|
|
|
"calling an ``@overload``-decorated function directly will raise :exc:"
|
|
|
|
|
"`NotImplementedError`."
|
|
|
|
|
msgstr ""
|
|
|
|
|
"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 types 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 ::"
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:2465
|
|
|
|
|
msgid ""
|
|
|
|
|
"An example of overload that gives a more precise type than can be expressed "
|
|
|
|
|
"using a union or a type variable:"
|
2019-05-23 16:59:19 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2482
|
2023-01-15 21:42:07 +00:00
|
|
|
|
#, fuzzy
|
2020-12-18 06:09:57 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"See :pep:`484` for more details and comparison with other typing semantics."
|
2021-05-19 20:32:24 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Voir la :pep:`484` pour plus de détails et la comparaison avec d'autres "
|
|
|
|
|
"sémantiques de typage."
|
2020-09-11 07:11:46 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2484
|
|
|
|
|
msgid ""
|
|
|
|
|
"Overloaded functions can now be introspected at runtime using :func:"
|
|
|
|
|
"`get_overloads`."
|
|
|
|
|
msgstr ""
|
|
|
|
|
"Les fonctions surchargées peuvent maintenant être inspectées durant "
|
|
|
|
|
"l'exécution via :func:`get_overloads`."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:2491
|
|
|
|
|
msgid ""
|
|
|
|
|
"Return a sequence of :func:`@overload <overload>`-decorated definitions for "
|
|
|
|
|
"*func*."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:2494
|
2022-05-22 21:15:02 +00:00
|
|
|
|
#, fuzzy
|
2023-07-23 12:39:39 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"*func* is the function object for the implementation of the overloaded "
|
|
|
|
|
"function. For example, given the definition of ``process`` in the "
|
|
|
|
|
"documentation for :func:`@overload <overload>`, ``get_overloads(process)`` "
|
|
|
|
|
"will return a sequence of three function objects for the three defined "
|
|
|
|
|
"overloads. If called on a function with no overloads, ``get_overloads()`` "
|
|
|
|
|
"returns an empty sequence."
|
|
|
|
|
msgstr ""
|
|
|
|
|
"Renvoie la séquence des définitions des fonctions décorées comme :func:"
|
|
|
|
|
"`@overload <overload>` associées à *func*. *func* est l'objet de la fonction "
|
|
|
|
|
"implémenté de base. Par exemple, en reprenant le définition de ``process`` "
|
|
|
|
|
"dans la documentation pour :func:`@overload <overload>`, "
|
|
|
|
|
"``get_overloads(process)`` renvoie une séquence composée de trois objets de "
|
|
|
|
|
"fonction associés aux trois fonctions surchargées définies. En cas d'appel à "
|
|
|
|
|
"``get_overloads()`` sur une fonction non surchargés, une séquence vide est "
|
|
|
|
|
"retournée."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:2501
|
|
|
|
|
msgid ""
|
|
|
|
|
"``get_overloads()`` can be used for introspecting an overloaded function at "
|
|
|
|
|
"runtime."
|
|
|
|
|
msgstr ""
|
|
|
|
|
"``get_overloads()`` peut être utilisé afin d'inspecter une fonction "
|
|
|
|
|
"surchargée durant l'exécution."
|
2019-09-04 09:35:23 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2509
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "Clear all registered overloads in the internal registry."
|
|
|
|
|
msgstr ""
|
|
|
|
|
"Suppression de toutes les surcharges enregistrées au sein du registre "
|
|
|
|
|
"interne. Cela peut être utilisé afin de récupérer la mémoire utilisé par le "
|
|
|
|
|
"registre."
|
2020-09-11 07:11:46 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2511
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "This can be used to reclaim the memory used by the registry."
|
|
|
|
|
msgstr ""
|
|
|
|
|
"Suppression de toutes les surcharges enregistrées au sein du registre "
|
|
|
|
|
"interne. Cela peut être utilisé afin de récupérer la mémoire utilisé par le "
|
|
|
|
|
"registre."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:2518
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "Decorator to indicate final methods and final classes."
|
|
|
|
|
msgstr ""
|
|
|
|
|
"Décorateur pour indiquer que les annotations ne sont pas des indications de "
|
|
|
|
|
"type."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:2520
|
2023-01-15 21:42:07 +00:00
|
|
|
|
#, fuzzy
|
2019-09-04 09:35:23 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Decorating a method with ``@final`` indicates to a type checker that the "
|
|
|
|
|
"method cannot be overridden in a subclass. Decorating a class with "
|
|
|
|
|
"``@final`` indicates that it cannot be subclassed."
|
2021-05-19 20:32:24 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +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
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2545
|
2022-05-22 21:15:02 +00:00
|
|
|
|
#, fuzzy
|
2023-07-23 12:39:39 +00:00
|
|
|
|
msgid ""
|
|
|
|
|
"The decorator will now attempt to set a ``__final__`` attribute to ``True`` "
|
|
|
|
|
"on the decorated object. Thus, a check like ``if getattr(obj, \"__final__\", "
|
|
|
|
|
"False)`` can be used at runtime to determine whether an object ``obj`` has "
|
|
|
|
|
"been marked as final. If the decorated object does not support setting "
|
|
|
|
|
"attributes, the decorator returns the object unchanged without raising an "
|
|
|
|
|
"exception."
|
|
|
|
|
msgstr ""
|
|
|
|
|
"Le décorateur met l'attribut ``__final__`` à ``True`` de l'objet décoré. "
|
|
|
|
|
"Cela permet d'utiliser une vérification comme ``if getattr(obj, "
|
|
|
|
|
"\"__final__\", False)`` durant l'exécution afin de vérifier si un objet "
|
|
|
|
|
"``obj`` est décoré comme ``final``. Dans le cas où l'objet décoré ne "
|
|
|
|
|
"supporte pas la modification d'attributs, le décorateur retournera l'objet "
|
|
|
|
|
"de base sans lever d'exception."
|
2020-09-11 07:11:46 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2556
|
|
|
|
|
msgid "Decorator to indicate that annotations are not type hints."
|
|
|
|
|
msgstr ""
|
|
|
|
|
"Décorateur pour indiquer que les annotations ne sont pas des indications de "
|
|
|
|
|
"type."
|
2019-09-04 09:35:23 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2558
|
|
|
|
|
#, fuzzy
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"This works as a class or function :term:`decorator`. With a class, it "
|
|
|
|
|
"applies recursively to all methods and classes defined in that class (but "
|
|
|
|
|
"not to methods defined in its superclasses or subclasses). Type checkers "
|
|
|
|
|
"will ignore all annotations in a function or class with this decorator."
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +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)."
|
2019-05-23 16:59:19 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2564
|
|
|
|
|
msgid "``@no_type_check`` mutates the decorated object in place."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:2568
|
|
|
|
|
msgid "Decorator to give another decorator the :func:`no_type_check` effect."
|
|
|
|
|
msgstr ""
|
|
|
|
|
"Décorateur pour donner à un autre décorateur l'effet :func:`no_type_check`."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:2570
|
|
|
|
|
msgid ""
|
|
|
|
|
"This wraps the decorator with something that wraps the decorated function "
|
|
|
|
|
"in :func:`no_type_check`."
|
|
|
|
|
msgstr ""
|
|
|
|
|
"Ceci enveloppe le décorateur avec quelque chose qui enveloppe la fonction "
|
|
|
|
|
"décorée dans :func:`no_type_check`."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:2575
|
2023-01-15 21:42:07 +00:00
|
|
|
|
#, fuzzy
|
2023-07-23 12:39:39 +00:00
|
|
|
|
msgid "Decorator to mark a class or function as unavailable at runtime."
|
|
|
|
|
msgstr ""
|
|
|
|
|
"Décorateur pour marquer une classe ou une fonction comme étant indisponible "
|
|
|
|
|
"au moment de l'exécution."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:2577
|
2020-12-18 06:09:57 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +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::"
|
2021-05-19 20:32:24 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +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
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2588
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Note that returning instances of private classes is not recommended. It is "
|
|
|
|
|
"usually preferable to make such classes public."
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +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."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:2592
|
|
|
|
|
msgid "Introspection helpers"
|
|
|
|
|
msgstr "Utilitaires d'introspection"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2596
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Return a dictionary containing type hints for a function, method, module or "
|
|
|
|
|
"class object."
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Renvoie un dictionnaire contenant des annotations de type pour une fonction, "
|
|
|
|
|
"une méthode, un module ou un objet de classe."
|
2018-06-10 09:32:30 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2599
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +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. For a class ``C``, return a "
|
|
|
|
|
"dictionary constructed by merging all the ``__annotations__`` along ``C."
|
|
|
|
|
"__mro__`` in reverse order."
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"C'est souvent équivalent à ``obj.__annotations__``. De plus, les références "
|
|
|
|
|
"postérieures encodées sous forme de chaîne de caractères sont évaluées dans "
|
|
|
|
|
"les espaces de nommage ``globals`` et ``locals``. Pour une classe ``C``, "
|
|
|
|
|
"elle renvoie un dictionnaire construit en fusionnant toutes les "
|
|
|
|
|
"``__annotations__`` en parcourant ``C.__mro__`` en ordre inverse."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2605
|
|
|
|
|
#, fuzzy
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +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:"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"La fonction remplace récursivement tous les ``Annotated[T, ...]`` avec "
|
|
|
|
|
"``T``, sauf si la valeur de ``include_extras`` est définie à ``True`` (voir :"
|
|
|
|
|
"class:`Annotated` pour plus d'information). Par exemple ::"
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:2622
|
|
|
|
|
msgid ""
|
|
|
|
|
":func:`get_type_hints` does not work with imported :ref:`type aliases <type-"
|
|
|
|
|
"aliases>` that include forward references. Enabling postponed evaluation of "
|
|
|
|
|
"annotations (:pep:`563`) may remove the need for most forward references."
|
|
|
|
|
msgstr ""
|
|
|
|
|
":func:`get_type_hints` ne fonctionne pas avec les :ref:`alias de type <type-"
|
|
|
|
|
"aliases>` importés contenant des références postérieures. L'activation "
|
|
|
|
|
"d'évaluation différée des annotations (:pep:`563`) permet de supprimer le "
|
|
|
|
|
"besoin de références postérieures supplémentaires."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2627
|
2023-01-15 21:42:07 +00:00
|
|
|
|
#, fuzzy
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Added ``include_extras`` parameter as part of :pep:`593`. See the "
|
|
|
|
|
"documentation on :data:`Annotated` for more information."
|
|
|
|
|
msgstr "Ajout du paramètre ``include_extras`` comme énoncé dans la :pep:`593`."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:2631
|
|
|
|
|
msgid ""
|
|
|
|
|
"Previously, ``Optional[t]`` was added for function and method annotations if "
|
|
|
|
|
"a default value equal to ``None`` was set. Now the annotation is returned "
|
|
|
|
|
"unchanged."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Avant, ``Optional[t]`` était ajouté pour les annotations de fonctions et de "
|
|
|
|
|
"méthodes dans le cas où une valeur par défaut était égal à ``None``. "
|
|
|
|
|
"Maintenant, les annotations sont renvoyées inchangées."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2638
|
|
|
|
|
msgid ""
|
|
|
|
|
"Get the unsubscripted version of a type: for a typing object of the form "
|
|
|
|
|
"``X[Y, Z, ...]`` return ``X``."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:2641
|
|
|
|
|
msgid ""
|
|
|
|
|
"If ``X`` is a typing-module alias for a builtin or :mod:`collections` class, "
|
|
|
|
|
"it will be normalized to the original class. If ``X`` is an instance of :"
|
|
|
|
|
"class:`ParamSpecArgs` or :class:`ParamSpecKwargs`, return the underlying :"
|
|
|
|
|
"class:`ParamSpec`. Return ``None`` for unsupported objects."
|
|
|
|
|
msgstr ""
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2670
|
2023-01-15 21:42:07 +00:00
|
|
|
|
#, fuzzy
|
2023-07-23 12:39:39 +00:00
|
|
|
|
msgid "Examples:"
|
|
|
|
|
msgstr "Par exemple ::"
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:2662
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Get type arguments with all substitutions performed: for a typing object of "
|
|
|
|
|
"the form ``X[Y, Z, ...]`` return ``(Y, Z, ...)``."
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgstr ""
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2665
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid ""
|
|
|
|
|
"If ``X`` is a union or :class:`Literal` contained in another generic type, "
|
|
|
|
|
"the order of ``(Y, Z, ...)`` may be different from the order of the original "
|
|
|
|
|
"arguments ``[Y, Z, ...]`` due to type caching. Return ``()`` for unsupported "
|
|
|
|
|
"objects."
|
|
|
|
|
msgstr ""
|
|
|
|
|
"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é vers la classe originale. "
|
|
|
|
|
"Si ``X`` est une union or un :class:`Literal` contenu dans un autre type "
|
|
|
|
|
"générique, l'ordre de ``(Y, Z, ...)`` peut différer de l'ordre des arguments "
|
|
|
|
|
"originels ``[Y, Z, ...]`` à cause du cache de types.Pour les objets non "
|
|
|
|
|
"gérés, renvoient ``None`` et ``()`` respectivement. Exemples ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2682
|
|
|
|
|
msgid "Check if a type is a :class:`TypedDict`."
|
|
|
|
|
msgstr "Vérifier si un type est un :class:`TypedDict`."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:2703
|
|
|
|
|
msgid ""
|
|
|
|
|
"Class used for internal typing representation of string forward references."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:2705
|
2023-01-15 21:42:07 +00:00
|
|
|
|
#, fuzzy
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"For example, ``List[\"SomeClass\"]`` is implicitly transformed into "
|
|
|
|
|
"``List[ForwardRef(\"SomeClass\")]``. ``ForwardRef`` should not be "
|
|
|
|
|
"instantiated by a user, but may be used by introspection tools."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Une classe utilisée pour le typage interne de la représentation des "
|
|
|
|
|
"références postérieures des chaînes de caractères. Par exemple, "
|
|
|
|
|
"``List[\"SomeClass\"]`` est implicitement transformé en "
|
|
|
|
|
"``List[ForwardRef(\"SomeClass\")]``. Cette classe ne doit pas être "
|
|
|
|
|
"instanciée par un utilisateur, mais peut être utilisée par des outils "
|
|
|
|
|
"d'introspection."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2710
|
|
|
|
|
msgid ""
|
|
|
|
|
":pep:`585` generic types such as ``list[\"SomeClass\"]`` will not be "
|
|
|
|
|
"implicitly transformed into ``list[ForwardRef(\"SomeClass\")]`` and thus "
|
|
|
|
|
"will not automatically resolve to ``list[SomeClass]``."
|
|
|
|
|
msgstr ""
|
|
|
|
|
"Les types :pep:`585` tels que ``list[\"SomeClass\"]`` ne seront pas "
|
|
|
|
|
"implicitement transformés en ``list[ForwardRef(\"SomeClass\")]`` et ne "
|
|
|
|
|
"seront donc pas automatiquement résolus en ``list[SomeClass]``."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:2717
|
|
|
|
|
msgid "Constant"
|
|
|
|
|
msgstr "Constante"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2721
|
2023-01-15 21:42:07 +00:00
|
|
|
|
#, fuzzy
|
2020-12-18 06:09:57 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"A special constant that is assumed to be ``True`` by 3rd party static type "
|
|
|
|
|
"checkers. It is ``False`` at runtime."
|
2021-05-19 20:32:24 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Constante spéciale qui vaut ``True`` pour les vérificateurs de types "
|
|
|
|
|
"statique tiers et ``False`` à l'exécution. Utilisation ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2732
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid ""
|
|
|
|
|
"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."
|
|
|
|
|
msgstr ""
|
|
|
|
|
"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."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2739
|
|
|
|
|
msgid ""
|
|
|
|
|
"If ``from __future__ import annotations`` is used, annotations are not "
|
|
|
|
|
"evaluated at function definition time. Instead, they are stored as strings "
|
|
|
|
|
"in ``__annotations__``. This makes it unnecessary to use quotes around the "
|
|
|
|
|
"annotation (see :pep:`563`)."
|
|
|
|
|
msgstr ""
|
|
|
|
|
"Si ``from __future__ import annotations`` est utilisé, les annotations ne "
|
|
|
|
|
"sont pas évaluées au moment de la définition de fonction. Elles sont alors "
|
|
|
|
|
"stockées comme des chaînes de caractères dans ``__annotations__``, ce qui "
|
|
|
|
|
"rend inutile l'utilisation de guillemets autour de l'annotation (Voir :pep:"
|
|
|
|
|
"`563`)."
|
2018-06-28 13:32:56 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2751
|
2023-01-15 21:42:07 +00:00
|
|
|
|
#, fuzzy
|
2023-07-23 12:39:39 +00:00
|
|
|
|
msgid "Deprecated aliases"
|
|
|
|
|
msgstr "Obsolète en"
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:2753
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"This module defines several deprecated aliases to pre-existing standard "
|
|
|
|
|
"library classes. These were originally included in the typing module in "
|
|
|
|
|
"order to support parameterizing these generic classes using ``[]``. However, "
|
|
|
|
|
"the aliases became redundant in Python 3.9 when the corresponding pre-"
|
|
|
|
|
"existing classes were enhanced to support ``[]`` (see :pep:`585`)."
|
2021-05-19 20:32:24 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
|
|
|
|
|
#: library/typing.rst:2760
|
|
|
|
|
msgid ""
|
|
|
|
|
"The redundant types are deprecated as of Python 3.9. However, while the "
|
|
|
|
|
"aliases may be removed at some point, removal of these aliases is not "
|
|
|
|
|
"currently planned. As such, no deprecation warnings are currently issued by "
|
|
|
|
|
"the interpreter for these aliases."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:2765
|
|
|
|
|
msgid ""
|
|
|
|
|
"If at some point it is decided to remove these deprecated aliases, a "
|
|
|
|
|
"deprecation warning will be issued by the interpreter for at least two "
|
|
|
|
|
"releases prior to removal. The aliases are guaranteed to remain in the "
|
|
|
|
|
"typing module without deprecation warnings until at least Python 3.14."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:2770
|
|
|
|
|
msgid ""
|
|
|
|
|
"Type checkers are encouraged to flag uses of the deprecated types if the "
|
|
|
|
|
"program they are checking targets a minimum Python version of 3.9 or newer."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:2776
|
|
|
|
|
msgid "Aliases to built-in types"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:2780
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "Deprecated alias to :class:`dict`."
|
|
|
|
|
msgstr "Vérifier si un type est un :class:`TypedDict`."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:2782
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid ""
|
|
|
|
|
"Note that to annotate arguments, it is preferred to use an abstract "
|
|
|
|
|
"collection type such as :class:`Mapping` rather than to use :class:`dict` "
|
|
|
|
|
"or :class:`!typing.Dict`."
|
|
|
|
|
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`."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:3026
|
|
|
|
|
msgid "This type can be used as follows::"
|
|
|
|
|
msgstr "Ce type peut être utilisé comme suit ::"
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:2791
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid ""
|
|
|
|
|
":class:`builtins.dict <dict>` now supports subscripting (``[]``). See :pep:"
|
|
|
|
|
"`585` and :ref:`types-genericalias`."
|
|
|
|
|
msgstr ""
|
|
|
|
|
":class:`builtins.dict <dict>` prend désormais en charge ``[]``. Voir :pep:"
|
|
|
|
|
"`585` et :ref:`types-genericalias`."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:2797
|
|
|
|
|
msgid "Deprecated alias to :class:`list`."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:2799
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid ""
|
|
|
|
|
"Note that to annotate arguments, it is preferred to use an abstract "
|
|
|
|
|
"collection type such as :class:`Sequence` or :class:`Iterable` rather than "
|
|
|
|
|
"to use :class:`list` or :class:`!typing.List`."
|
|
|
|
|
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`."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:2803
|
|
|
|
|
msgid "This type may be used as follows::"
|
|
|
|
|
msgstr "Ce type peut être utilisé comme suit ::"
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:2813
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid ""
|
|
|
|
|
":class:`builtins.list <list>` now supports subscripting (``[]``). See :pep:"
|
|
|
|
|
"`585` and :ref:`types-genericalias`."
|
|
|
|
|
msgstr ""
|
|
|
|
|
":class:`builtins.list <list>` prend désormais en charge ``[]``. Voir :pep:"
|
|
|
|
|
"`585` et :ref:`types-genericalias`."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:2819
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "Deprecated alias to :class:`builtins.set <set>`."
|
|
|
|
|
msgstr "Une version générique de :class:`builtins.frozenset <frozenset>`."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:2821
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid ""
|
|
|
|
|
"Note that to annotate arguments, it is preferred to use an abstract "
|
|
|
|
|
"collection type such as :class:`AbstractSet` rather than to use :class:`set` "
|
|
|
|
|
"or :class:`!typing.Set`."
|
|
|
|
|
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`."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:2825
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid ""
|
|
|
|
|
":class:`builtins.set <set>` now supports subscripting (``[]``). See :pep:"
|
|
|
|
|
"`585` and :ref:`types-genericalias`."
|
|
|
|
|
msgstr ""
|
|
|
|
|
":class:`builtins.set <set>` prend désormais en charge ``[]``. Voir :pep:"
|
|
|
|
|
"`585` et :ref:`types-genericalias`."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:2831
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "Deprecated alias to :class:`builtins.frozenset <frozenset>`."
|
|
|
|
|
msgstr "Une version générique de :class:`builtins.frozenset <frozenset>`."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:2833
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid ""
|
|
|
|
|
":class:`builtins.frozenset <frozenset>` now supports subscripting (``[]``). "
|
|
|
|
|
"See :pep:`585` and :ref:`types-genericalias`."
|
|
|
|
|
msgstr ""
|
|
|
|
|
":class:`builtins.frozenset <frozenset>` prend désormais en charge ``[]``. "
|
2021-05-19 20:32:24 +00:00
|
|
|
|
"Voir :pep:`585` et :ref:`types-genericalias`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2840
|
|
|
|
|
msgid "Deprecated alias for :class:`tuple`."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:2842
|
|
|
|
|
msgid ""
|
|
|
|
|
":class:`tuple` and ``Tuple`` are special-cased in the type system; see :ref:"
|
|
|
|
|
"`annotating-tuples` for more details."
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgstr ""
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2845
|
2023-01-15 21:42:07 +00:00
|
|
|
|
#, fuzzy
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
":class:`builtins.tuple <tuple>` now supports subscripting (``[]``). See :pep:"
|
|
|
|
|
"`585` and :ref:`types-genericalias`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
":class:`builtins.tuple <tuple>` prend désormais en charge ``[]``. Voir :pep:"
|
|
|
|
|
"`585` et :ref:`types-genericalias`."
|
2018-09-15 19:51:48 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2851
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "Deprecated alias to :class:`type`."
|
|
|
|
|
msgstr "Vérifier si un type est un :class:`TypedDict`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2853
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"See :ref:`type-of-class-objects` for details on using :class:`type` or "
|
|
|
|
|
"``typing.Type`` in type annotations."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
2020-09-11 07:11:46 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2858
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid ""
|
|
|
|
|
":class:`builtins.type <type>` now supports subscripting (``[]``). See :pep:"
|
|
|
|
|
"`585` and :ref:`types-genericalias`."
|
|
|
|
|
msgstr ""
|
|
|
|
|
":class:`builtins.type <type>` prend désormais en charge ``[]``. Voir :pep:"
|
|
|
|
|
"`585` et :ref:`types-genericalias`."
|
2020-09-11 07:11:46 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2865
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "Aliases to types in :mod:`collections`"
|
|
|
|
|
msgstr "Correspond aux autres types au sein de :mod:`collections.abc`."
|
2020-09-11 07:11:46 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2869
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "Deprecated alias to :class:`collections.defaultdict`."
|
|
|
|
|
msgstr "Une version générique de :class:`collections.defaultdict`."
|
2020-09-11 07:11:46 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2873
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid ""
|
|
|
|
|
":class:`collections.defaultdict` now supports subscripting (``[]``). See :"
|
|
|
|
|
"pep:`585` and :ref:`types-genericalias`."
|
|
|
|
|
msgstr ""
|
|
|
|
|
":class:`collections.defaultdict` prend désormais en charge ``[]``. Voir :pep:"
|
|
|
|
|
"`585` et :ref:`types-genericalias`."
|
2020-09-11 07:11:46 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2879
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "Deprecated alias to :class:`collections.OrderedDict`."
|
|
|
|
|
msgstr "Une version générique de :class:`collections.OrderedDict`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2883
|
|
|
|
|
#, fuzzy
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
":class:`collections.OrderedDict` now supports subscripting (``[]``). See :"
|
|
|
|
|
"pep:`585` and :ref:`types-genericalias`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
":class:`collections.OrderedDict` prend désormais en charge ``[]``. Voir :pep:"
|
|
|
|
|
"`585` et :ref:`types-genericalias`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2889
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#, fuzzy
|
2023-07-23 12:39:39 +00:00
|
|
|
|
msgid "Deprecated alias to :class:`collections.ChainMap`."
|
|
|
|
|
msgstr "Une version générique de :class:`collections.ChainMap`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2894
|
|
|
|
|
#, fuzzy
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
":class:`collections.ChainMap` now supports subscripting (``[]``). See :pep:"
|
|
|
|
|
"`585` and :ref:`types-genericalias`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
":class:`collections.ChainMap` prend désormais en charge ``[]``. Voir :pep:"
|
|
|
|
|
"`585` et :ref:`types-genericalias`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2900
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "Deprecated alias to :class:`collections.Counter`."
|
|
|
|
|
msgstr "Une version générique de :class:`collections.Counter`."
|
2022-03-23 17:40:12 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2905
|
|
|
|
|
#, fuzzy
|
2022-03-23 17:40:12 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
":class:`collections.Counter` now supports subscripting (``[]``). See :pep:"
|
|
|
|
|
"`585` and :ref:`types-genericalias`."
|
2022-03-23 17:40:12 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
":class:`collections.Counter` prend désormais en charge ``[]``. Voir :pep:"
|
|
|
|
|
"`585` et :ref:`types-genericalias`."
|
2022-03-23 17:40:12 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2911
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "Deprecated alias to :class:`collections.deque`."
|
|
|
|
|
msgstr "Une version générique de :class:`collections.deque`."
|
2022-03-23 17:40:12 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2916
|
|
|
|
|
#, fuzzy
|
2022-03-23 17:40:12 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
":class:`collections.deque` now supports subscripting (``[]``). See :pep:"
|
|
|
|
|
"`585` and :ref:`types-genericalias`."
|
2022-03-23 17:40:12 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
":class:`collections.deque` prend désormais en charge ``[]``. Voir :pep:`585` "
|
|
|
|
|
"et :ref:`types-genericalias`."
|
2022-03-23 17:40:12 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2923
|
|
|
|
|
msgid "Aliases to other concrete types"
|
2022-03-23 17:40:12 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2928
|
2022-03-23 17:40:12 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Deprecated aliases corresponding to the return types from :func:`re.compile` "
|
|
|
|
|
"and :func:`re.match`."
|
2022-03-23 17:40:12 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2931
|
|
|
|
|
#, fuzzy
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"These types (and the corresponding functions) are generic over :data:"
|
|
|
|
|
"`AnyStr`. ``Pattern`` can be specialised as ``Pattern[str]`` or "
|
|
|
|
|
"``Pattern[bytes]``; ``Match`` can be specialised as ``Match[str]`` or "
|
|
|
|
|
"``Match[bytes]``."
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +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]``."
|
2022-03-23 17:40:12 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2939
|
2022-03-23 17:40:12 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"The ``typing.re`` namespace is deprecated and will be removed. These types "
|
|
|
|
|
"should be directly imported from ``typing`` instead."
|
2022-03-23 17:40:12 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2940
|
2022-03-23 17:40:12 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Classes ``Pattern`` and ``Match`` from :mod:`re` now support ``[]``. See :"
|
|
|
|
|
"pep:`585` and :ref:`types-genericalias`."
|
2022-03-23 17:40:12 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2946
|
|
|
|
|
msgid "Deprecated alias for :class:`str`."
|
2022-03-23 17:40:12 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2948
|
|
|
|
|
#, fuzzy
|
2022-03-23 17:40:12 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"``Text`` is provided to supply a forward compatible path for Python 2 code: "
|
|
|
|
|
"in Python 2, ``Text`` is an alias for ``unicode``."
|
2022-03-23 17:40:12 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +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``."
|
2022-03-23 17:40:12 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2952
|
2022-03-23 17:40:12 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +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::"
|
2022-03-23 17:40:12 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +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 ::"
|
2022-03-23 17:40:12 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2960
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Python 2 is no longer supported, and most type checkers also no longer "
|
|
|
|
|
"support type checking Python 2 code. Removal of the alias is not currently "
|
|
|
|
|
"planned, but users are encouraged to use :class:`str` instead of ``Text``."
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2970
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "Aliases to container ABCs in :mod:`collections.abc`"
|
|
|
|
|
msgstr "Correspond aux collections au sein de :mod:`collections.abc`"
|
2022-05-22 21:15:02 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2974
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "Deprecated alias to :class:`collections.abc.Set`."
|
|
|
|
|
msgstr "Un alias pour :class:`collections.abc.Sized`"
|
2022-05-22 21:15:02 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2976
|
|
|
|
|
#, fuzzy
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
":class:`collections.abc.Set` now supports subscripting (``[]``). See :pep:"
|
|
|
|
|
"`585` and :ref:`types-genericalias`."
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
":class:`collections.abc.Set` prend désormais en charge ``[]``. Voir :pep:"
|
|
|
|
|
"`585` et :ref:`types-genericalias`."
|
2022-05-22 21:15:02 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2982
|
|
|
|
|
#, fuzzy
|
2023-01-15 21:42:07 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"This type represents the types :class:`bytes`, :class:`bytearray`, and :"
|
|
|
|
|
"class:`memoryview` of byte sequences."
|
2023-01-15 21:42:07 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Ce type représente les types :class:`bytes`, :class:`bytearray` et :class:"
|
|
|
|
|
"`memoryview`."
|
2023-01-15 21:42:07 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2986
|
2023-01-15 21:42:07 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Prefer ``typing_extensions.Buffer``, or a union like ``bytes | bytearray | "
|
|
|
|
|
"memoryview``."
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:2990
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "Deprecated alias to :class:`collections.abc.Collection`."
|
|
|
|
|
msgstr "Une version générique de :class:`collections.abc.Collection`"
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:2994
|
|
|
|
|
#, fuzzy
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
":class:`collections.abc.Collection` now supports subscripting (``[]``). See :"
|
|
|
|
|
"pep:`585` and :ref:`types-genericalias`."
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
":class:`collections.abc.Collection` prend désormais en charge ``[]``. Voir :"
|
|
|
|
|
"pep:`585` et :ref:`types-genericalias`."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:3000
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "Deprecated alias to :class:`collections.abc.Container`."
|
|
|
|
|
msgstr "Un alias pour :class:`collections.abc.Sized`"
|
2022-05-22 21:15:02 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:3002
|
|
|
|
|
#, fuzzy
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
":class:`collections.abc.Container` now supports subscripting (``[]``). See :"
|
|
|
|
|
"pep:`585` and :ref:`types-genericalias`."
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
":class:`collections.abc.Container` prend désormais en charge ``[]``. Voir :"
|
|
|
|
|
"pep:`585` et :ref:`types-genericalias`."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:3008
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "Deprecated alias to :class:`collections.abc.ItemsView`."
|
|
|
|
|
msgstr "Un alias pour :class:`collections.abc.Sized`"
|
2022-05-22 21:15:02 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:3010
|
|
|
|
|
#, fuzzy
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
":class:`collections.abc.ItemsView` now supports subscripting (``[]``). See :"
|
|
|
|
|
"pep:`585` and :ref:`types-genericalias`."
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
":class:`collections.abc.ItemsView` prend désormais en charge ``[]``. Voir :"
|
|
|
|
|
"pep:`585` et :ref:`types-genericalias`."
|
2022-05-22 21:15:02 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:3016
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "Deprecated alias to :class:`collections.abc.KeysView`."
|
|
|
|
|
msgstr "Un alias pour :class:`collections.abc.Sized`"
|
2022-05-22 21:15:02 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:3018
|
|
|
|
|
#, fuzzy
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
":class:`collections.abc.KeysView` now supports subscripting (``[]``). See :"
|
|
|
|
|
"pep:`585` and :ref:`types-genericalias`."
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
":class:`collections.abc.KeysView` prend désormais en charge ``[]``. Voir :"
|
|
|
|
|
"pep:`585` et :ref:`types-genericalias`."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:3024
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "Deprecated alias to :class:`collections.abc.Mapping`."
|
|
|
|
|
msgstr "Un alias pour :class:`collections.abc.Sized`"
|
2022-05-22 21:15:02 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:3031
|
|
|
|
|
#, fuzzy
|
2023-01-15 21:42:07 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
":class:`collections.abc.Mapping` now supports subscripting (``[]``). See :"
|
|
|
|
|
"pep:`585` and :ref:`types-genericalias`."
|
2023-01-15 21:42:07 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
":class:`collections.abc.Mapping` prend désormais en charge ``[]``. Voir :pep:"
|
|
|
|
|
"`585` et :ref:`types-genericalias`."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:3037
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "Deprecated alias to :class:`collections.abc.MappingView`."
|
|
|
|
|
msgstr "Une version générique de :class:`collections.abc.MappingView`."
|
2023-01-15 21:42:07 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:3039
|
|
|
|
|
#, fuzzy
|
2023-01-15 21:42:07 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
":class:`collections.abc.MappingView` now supports subscripting (``[]``). "
|
|
|
|
|
"See :pep:`585` and :ref:`types-genericalias`."
|
2023-01-15 21:42:07 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
":class:`collections.abc.MappingView` prend désormais en charge ``[]``. Voir :"
|
|
|
|
|
"pep:`585` et :ref:`types-genericalias`."
|
2023-01-15 21:42:07 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:3045
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "Deprecated alias to :class:`collections.abc.MutableMapping`."
|
|
|
|
|
msgstr "Une version générique de :class:`collections.abc.MutableMapping`."
|
2023-01-15 21:42:07 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:3047
|
|
|
|
|
#, fuzzy
|
2023-01-15 21:42:07 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
":class:`collections.abc.MutableMapping` now supports subscripting (``[]``). "
|
|
|
|
|
"See :pep:`585` and :ref:`types-genericalias`."
|
2023-01-15 21:42:07 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
":class:`collections.abc.MutableMapping` prend désormais en charge ``[]``. "
|
|
|
|
|
"Voir :pep:`585` et :ref:`types-genericalias`."
|
2023-01-15 21:42:07 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:3054
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "Deprecated alias to :class:`collections.abc.MutableSequence`."
|
|
|
|
|
msgstr "Une version générique de :class:`collections.abc.MutableSequence`."
|
2023-01-15 21:42:07 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:3056
|
|
|
|
|
#, fuzzy
|
2023-01-15 21:42:07 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
":class:`collections.abc.MutableSequence` now supports subscripting (``[]``). "
|
|
|
|
|
"See :pep:`585` and :ref:`types-genericalias`."
|
2023-01-15 21:42:07 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
":class:`collections.abc.MutableSequence` prend désormais en charge ``[]``. "
|
|
|
|
|
"Voir :pep:`585` et :ref:`types-genericalias`."
|
2023-01-15 21:42:07 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:3063
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "Deprecated alias to :class:`collections.abc.MutableSet`."
|
|
|
|
|
msgstr "Un alias pour :class:`collections.abc.Hashable`"
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:3065
|
|
|
|
|
#, fuzzy
|
2023-01-15 21:42:07 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
":class:`collections.abc.MutableSet` now supports subscripting (``[]``). See :"
|
|
|
|
|
"pep:`585` and :ref:`types-genericalias`."
|
2023-01-15 21:42:07 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
":class:`collections.abc.MutableSet` prend désormais en charge ``[]``. Voir :"
|
|
|
|
|
"pep:`585` et :ref:`types-genericalias`."
|
2023-01-15 21:42:07 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:3071
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "Deprecated alias to :class:`collections.abc.Sequence`."
|
|
|
|
|
msgstr "Un alias pour :class:`collections.abc.Sized`"
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:3073
|
|
|
|
|
#, fuzzy
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
":class:`collections.abc.Sequence` now supports subscripting (``[]``). See :"
|
|
|
|
|
"pep:`585` and :ref:`types-genericalias`."
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
":class:`collections.abc.Sequence` prend désormais en charge ``[]``. Voir :"
|
|
|
|
|
"pep:`585` et :ref:`types-genericalias`."
|
2022-05-22 21:15:02 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:3079
|
2022-05-22 21:15:02 +00:00
|
|
|
|
#, fuzzy
|
2023-07-23 12:39:39 +00:00
|
|
|
|
msgid "Deprecated alias to :class:`collections.abc.ValuesView`."
|
|
|
|
|
msgstr "Une version générique de :class:`collections.abc.ValuesView`."
|
2022-05-22 21:15:02 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:3081
|
|
|
|
|
#, fuzzy
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
":class:`collections.abc.ValuesView` now supports subscripting (``[]``). See :"
|
|
|
|
|
"pep:`585` and :ref:`types-genericalias`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
":class:`collections.abc.ValuesView` prend désormais en charge ``[]``. Voir :"
|
|
|
|
|
"pep:`585` et :ref:`types-genericalias`."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:3088
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "Aliases to asynchronous ABCs in :mod:`collections.abc`"
|
|
|
|
|
msgstr "Correspond aux collections au sein de :mod:`collections.abc`"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:3092
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "Deprecated alias to :class:`collections.abc.Coroutine`."
|
|
|
|
|
msgstr "Un alias pour :class:`collections.abc.Sized`"
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:3094
|
2023-01-15 21:42:07 +00:00
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"The variance and order of type variables correspond to those of :class:"
|
|
|
|
|
"`Generator`, for example::"
|
2019-09-04 09:35:23 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"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-09-04 09:35:23 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:3105
|
|
|
|
|
#, fuzzy
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
":class:`collections.abc.Coroutine` now supports subscripting (``[]``). See :"
|
|
|
|
|
"pep:`585` and :ref:`types-genericalias`."
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
":class:`collections.abc.Coroutine` prend désormais en charge ``[]``. Voir :"
|
|
|
|
|
"pep:`585` et :ref:`types-genericalias`."
|
2022-05-22 21:15:02 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:3111
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "Deprecated alias to :class:`collections.abc.AsyncGenerator`."
|
|
|
|
|
msgstr "Une version générique de :class:`collections.abc.AsyncIterator`."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:3113
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"An async generator can be annotated by the generic type "
|
|
|
|
|
"``AsyncGenerator[YieldType, SendType]``. For example::"
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Un générateur asynchrone peut être annoté par le type générique "
|
|
|
|
|
"``AsyncGenerator[YieldType, SendType]``. Par exemple ::"
|
2022-05-22 21:15:02 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:3122
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Unlike normal generators, async generators cannot return a value, so there "
|
|
|
|
|
"is no ``ReturnType`` type parameter. As with :class:`Generator`, the "
|
|
|
|
|
"``SendType`` behaves contravariantly."
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"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."
|
2022-05-22 21:15:02 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:3126
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"If your generator will only yield values, set the ``SendType`` to ``None``::"
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Si votre générateur ne donne que des valeurs, réglez le paramètre "
|
|
|
|
|
"``SendType`` sur ``None`` ::"
|
2022-05-22 21:15:02 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:3134
|
2019-09-04 09:35:23 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Alternatively, annotate your generator as having a return type of either "
|
|
|
|
|
"``AsyncIterable[YieldType]`` or ``AsyncIterator[YieldType]``::"
|
2019-09-04 09:35:23 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Alternativement, annotez votre générateur comme ayant un type de retour soit "
|
|
|
|
|
"``AsyncIterable[YieldType]`` ou ``AsyncIterator[YieldType]`` ::"
|
2019-09-04 09:35:23 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:3144
|
|
|
|
|
#, fuzzy
|
2022-03-23 17:40:12 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
":class:`collections.abc.AsyncGenerator` now supports subscripting (``[]``). "
|
|
|
|
|
"See :pep:`585` and :ref:`types-genericalias`."
|
2022-03-23 17:40:12 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
":class:`collections.abc.AsyncGenerator` prend désormais en charge ``[]``. "
|
|
|
|
|
"Voir :pep:`585` et :ref:`types-genericalias`."
|
2022-03-23 17:40:12 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:3151
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "Deprecated alias to :class:`collections.abc.AsyncIterable`."
|
|
|
|
|
msgstr "Une version générique de :class:`collections.abc.AsyncIterable`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:3155
|
2022-03-23 17:40:12 +00:00
|
|
|
|
#, fuzzy
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
":class:`collections.abc.AsyncIterable` now supports subscripting (``[]``). "
|
|
|
|
|
"See :pep:`585` and :ref:`types-genericalias`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
":class:`collections.abc.AsyncIterable` prend désormais en charge ``[]``. "
|
|
|
|
|
"Voir :pep:`585` et :ref:`types-genericalias`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:3161
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "Deprecated alias to :class:`collections.abc.AsyncIterator`."
|
|
|
|
|
msgstr "Une version générique de :class:`collections.abc.AsyncIterator`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:3165
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid ""
|
|
|
|
|
":class:`collections.abc.AsyncIterator` now supports subscripting (``[]``). "
|
|
|
|
|
"See :pep:`585` and :ref:`types-genericalias`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
":class:`collections.abc.AsyncIterator` prend désormais en charge ``[]``. "
|
|
|
|
|
"Voir :pep:`585` et :ref:`types-genericalias`."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:3171
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "Deprecated alias to :class:`collections.abc.Awaitable`."
|
|
|
|
|
msgstr "Un alias pour :class:`collections.abc.Hashable`"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:3175
|
|
|
|
|
#, fuzzy
|
2019-09-04 09:35:23 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
":class:`collections.abc.Awaitable` now supports subscripting (``[]``). See :"
|
|
|
|
|
"pep:`585` and :ref:`types-genericalias`."
|
2019-09-04 09:35:23 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
":class:`collections.abc.Awaitable` prend désormais en charge ``[]``. Voir :"
|
|
|
|
|
"pep:`585` et :ref:`types-genericalias`."
|
2019-09-04 09:35:23 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:3182
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "Aliases to other ABCs in :mod:`collections.abc`"
|
|
|
|
|
msgstr "Correspond aux autres types au sein de :mod:`collections.abc`."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:3186
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "Deprecated alias to :class:`collections.abc.Iterable`."
|
|
|
|
|
msgstr "Un alias pour :class:`collections.abc.Hashable`"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:3188
|
|
|
|
|
#, fuzzy
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
":class:`collections.abc.Iterable` now supports subscripting (``[]``). See :"
|
|
|
|
|
"pep:`585` and :ref:`types-genericalias`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
":class:`collections.abc.Iterable` prend désormais en charge ``[]``. Voir :"
|
|
|
|
|
"pep:`585` et :ref:`types-genericalias`."
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:3194
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "Deprecated alias to :class:`collections.abc.Iterator`."
|
|
|
|
|
msgstr "Une version générique de :class:`collections.abc.Iterator`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:3196
|
|
|
|
|
#, fuzzy
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
":class:`collections.abc.Iterator` now supports subscripting (``[]``). See :"
|
|
|
|
|
"pep:`585` and :ref:`types-genericalias`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
":class:`collections.abc.Iterator` prend désormais en charge ``[]``. Voir :"
|
|
|
|
|
"pep:`585` et :ref:`types-genericalias`."
|
2017-05-27 17:46:38 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:3202
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "Deprecated alias to :class:`collections.abc.Callable`."
|
|
|
|
|
msgstr "Un alias pour :class:`collections.abc.Hashable`"
|
2020-07-20 08:56:42 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:3204
|
2020-07-20 08:56:42 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"See :ref:`annotating-callables` for details on how to use :class:"
|
|
|
|
|
"`collections.abc.Callable` and ``typing.Callable`` in type annotations."
|
2020-07-20 08:56:42 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:3207
|
|
|
|
|
#, fuzzy
|
2020-07-20 08:56:42 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
":class:`collections.abc.Callable` now supports subscripting (``[]``). See :"
|
|
|
|
|
"pep:`585` and :ref:`types-genericalias`."
|
2020-07-20 08:56:42 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
":class:`collections.abc.Callable` prend désormais en charge ``[]``. Voir :"
|
|
|
|
|
"pep:`585` et :ref:`types-genericalias`."
|
2020-07-20 08:56:42 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:3217
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "Deprecated alias to :class:`collections.abc.Generator`."
|
|
|
|
|
msgstr "Un alias pour :class:`collections.abc.Sized`"
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:3219
|
2020-07-20 08:56:42 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"A generator can be annotated by the generic type ``Generator[YieldType, "
|
|
|
|
|
"SendType, ReturnType]``. For example::"
|
2020-07-20 08:56:42 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Un générateur peut être annoté par le type générique ``Generator[YieldType, "
|
|
|
|
|
"SendType, ReturnType]``. Par exemple ::"
|
2020-07-20 08:56:42 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:3228
|
2021-09-24 08:20:01 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Note that unlike many other generics in the typing module, the ``SendType`` "
|
|
|
|
|
"of :class:`Generator` behaves contravariantly, not covariantly or "
|
|
|
|
|
"invariantly."
|
2021-09-24 08:20:01 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +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."
|
2020-07-20 08:56:42 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:3232
|
2022-03-23 17:40:12 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"If your generator will only yield values, set the ``SendType`` and "
|
|
|
|
|
"``ReturnType`` to ``None``::"
|
2022-03-23 17:40:12 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Si votre générateur ne donne que des valeurs, réglez les paramètres "
|
|
|
|
|
"``SendType`` et ``ReturnType`` sur ``None`` ::"
|
2022-03-23 17:40:12 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:3240
|
|
|
|
|
msgid ""
|
|
|
|
|
"Alternatively, annotate your generator as having a return type of either "
|
|
|
|
|
"``Iterable[YieldType]`` or ``Iterator[YieldType]``::"
|
2020-07-20 08:56:42 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Alternativement, annotez votre générateur comme ayant un type de retour soit "
|
|
|
|
|
"``Iterable[YieldType]`` ou ``Iterator[YieldType]`` ::"
|
2020-07-20 08:56:42 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:3248
|
|
|
|
|
#, fuzzy
|
2020-07-20 08:56:42 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
":class:`collections.abc.Generator` now supports subscripting (``[]``). See :"
|
|
|
|
|
"pep:`585` and :ref:`types-genericalias`."
|
2020-07-20 08:56:42 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
":class:`collections.abc.Generator` prend désormais en charge ``[]``. Voir :"
|
|
|
|
|
"pep:`585` et :ref:`types-genericalias`."
|
2020-07-20 08:56:42 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:3254
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "Alias to :class:`collections.abc.Hashable`."
|
|
|
|
|
msgstr "Un alias pour :class:`collections.abc.Hashable`"
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:3258
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "Deprecated alias to :class:`collections.abc.Reversible`."
|
|
|
|
|
msgstr "Un alias pour :class:`collections.abc.Hashable`"
|
2021-09-24 08:20:01 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:3260
|
|
|
|
|
#, fuzzy
|
2020-07-20 08:56:42 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
":class:`collections.abc.Reversible` now supports subscripting (``[]``). See :"
|
|
|
|
|
"pep:`585` and :ref:`types-genericalias`."
|
2020-07-20 08:56:42 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
":class:`collections.abc.Reversible` prend désormais en charge ``[]``. Voir :"
|
|
|
|
|
"pep:`585` et :ref:`types-genericalias`."
|
2020-07-20 08:56:42 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:3266
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "Alias to :class:`collections.abc.Sized`."
|
|
|
|
|
msgstr "Un alias pour :class:`collections.abc.Sized`"
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:3271
|
|
|
|
|
msgid "Aliases to :mod:`contextlib` ABCs"
|
2021-05-26 17:39:06 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:3275
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid "Deprecated alias to :class:`contextlib.AbstractContextManager`."
|
|
|
|
|
msgstr "Une version générique de :class:`contextlib.AbstractContextManager`."
|
2020-07-20 08:56:42 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:3280
|
|
|
|
|
#, fuzzy
|
2020-07-20 08:56:42 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
":class:`contextlib.AbstractContextManager` now supports subscripting "
|
|
|
|
|
"(``[]``). See :pep:`585` and :ref:`types-genericalias`."
|
2020-07-20 08:56:42 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
":class:`contextlib.AbstractContextManager` prend désormais en charge ``[]``. "
|
|
|
|
|
"Voir :pep:`585` et :ref:`types-genericalias`."
|
2020-07-20 08:56:42 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:3287
|
2020-09-11 07:11:46 +00:00
|
|
|
|
#, fuzzy
|
2023-07-23 12:39:39 +00:00
|
|
|
|
msgid "Deprecated alias to :class:`contextlib.AbstractAsyncContextManager`."
|
2020-07-20 08:56:42 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
"Une version générique de :class:`contextlib.AbstractAsyncContextManager`."
|
2020-07-20 08:56:42 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:3292
|
|
|
|
|
#, fuzzy
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgid ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
":class:`contextlib.AbstractAsyncContextManager` now supports subscripting "
|
|
|
|
|
"(``[]``). See :pep:`585` and :ref:`types-genericalias`."
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgstr ""
|
2023-07-23 12:39:39 +00:00
|
|
|
|
":class:`contextlib.AbstractAsyncContextManager` prend désormais en charge "
|
|
|
|
|
"``[]``. Voir :pep:`585` et :ref:`types-genericalias`."
|
2022-05-22 21:15:02 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:3298
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgid "Deprecation Timeline of Major Features"
|
2023-02-17 16:53:03 +00:00
|
|
|
|
msgstr "Étapes d'Obsolescence des Fonctionnalités Majeures"
|
2022-05-22 21:15:02 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:3300
|
2020-09-11 07:11:46 +00:00
|
|
|
|
msgid ""
|
2022-05-22 21:15:02 +00:00
|
|
|
|
"Certain features in ``typing`` are deprecated and may be removed in a future "
|
|
|
|
|
"version of Python. The following table summarizes major deprecations for "
|
|
|
|
|
"your convenience. This is subject to change, and not all deprecations are "
|
|
|
|
|
"listed."
|
|
|
|
|
msgstr ""
|
2023-02-17 16:53:03 +00:00
|
|
|
|
"Certaines fonctionnalités dans ``typing`` sont obsolètes et peuvent être "
|
|
|
|
|
"supprimées dans une future version de Python. Le tableau suivant résume les "
|
|
|
|
|
"principales dépréciations. Celui-ci peut changer et toutes les dépréciations "
|
|
|
|
|
"ne sont pas listées."
|
2022-05-22 21:15:02 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:3307
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgid "Feature"
|
2023-02-17 16:53:03 +00:00
|
|
|
|
msgstr "Fonctionnalité"
|
2022-05-22 21:15:02 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:3308
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgid "Deprecated in"
|
2023-02-17 16:53:03 +00:00
|
|
|
|
msgstr "Obsolète en"
|
2022-05-22 21:15:02 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:3309
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgid "Projected removal"
|
2023-02-17 16:53:03 +00:00
|
|
|
|
msgstr "Suppression prévue"
|
2022-05-22 21:15:02 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:3310
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgid "PEP/issue"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:3311
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgid "``typing.io`` and ``typing.re`` submodules"
|
2023-02-17 16:53:03 +00:00
|
|
|
|
msgstr "sous-modules ``typing.io`` et ``typing.re``"
|
2022-05-22 21:15:02 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:3312
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgid "3.8"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:3313
|
2023-01-15 21:42:07 +00:00
|
|
|
|
msgid "3.13"
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:3314
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgid ":issue:`38291`"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:3315
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgid "``typing`` versions of standard collections"
|
2023-02-17 16:53:03 +00:00
|
|
|
|
msgstr "Versions de typage des collections standards"
|
2022-05-22 21:15:02 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:3320
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgid "3.9"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:3317
|
|
|
|
|
msgid "Undecided (see :ref:`deprecated-typing-aliases` for more information)"
|
|
|
|
|
msgstr ""
|
2022-05-22 21:15:02 +00:00
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:3318
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgid ":pep:`585`"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:3319
|
|
|
|
|
msgid ":class:`typing.ByteString`"
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:3321
|
|
|
|
|
msgid "3.14"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:3322
|
|
|
|
|
msgid ":gh:`91896`"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:3323
|
|
|
|
|
msgid ":data:`typing.Text`"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:3324
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgid "3.11"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#: library/typing.rst:3325
|
|
|
|
|
msgid "Undecided"
|
|
|
|
|
msgstr "Non défini"
|
|
|
|
|
|
|
|
|
|
#: library/typing.rst:3326
|
2022-05-22 21:15:02 +00:00
|
|
|
|
msgid ":gh:`92332`"
|
2020-07-20 08:56:42 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
2023-07-23 20:51:30 +00:00
|
|
|
|
#, fuzzy
|
|
|
|
|
#~ msgid ":pep:`698`: Adding an override decorator to typing"
|
|
|
|
|
#~ msgstr ":pep:`591`: Ajout d'un qualificatif final au typage"
|
|
|
|
|
|
|
|
|
|
#, fuzzy
|
|
|
|
|
#~ msgid "*Introducing* the :func:`@override<override>` decorator"
|
|
|
|
|
#~ msgstr "*Ajout* de :data:`Final` et du décorateur :func:`@final<final>`"
|
|
|
|
|
|
|
|
|
|
#~ msgid ""
|
|
|
|
|
#~ "Note that ``None`` as a type hint is a special case and is replaced by "
|
|
|
|
|
#~ "``type(None)``."
|
|
|
|
|
#~ msgstr ""
|
|
|
|
|
#~ "Notez que ``None`` comme annotation de type est un cas particulier et est "
|
|
|
|
|
#~ "remplacé par ``type(None)``."
|
|
|
|
|
|
|
|
|
|
#~ msgid "Callable"
|
|
|
|
|
#~ msgstr "Appelable"
|
|
|
|
|
|
|
|
|
|
#~ msgid ""
|
|
|
|
|
#~ "Frameworks expecting callback functions of specific signatures might be "
|
|
|
|
|
#~ "type hinted using ``Callable[[Arg1Type, Arg2Type], ReturnType]``."
|
|
|
|
|
#~ msgstr ""
|
|
|
|
|
#~ "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]``."
|
|
|
|
|
|
|
|
|
|
#~ 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 ""
|
|
|
|
|
#~ "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]``."
|
|
|
|
|
|
|
|
|
|
#, fuzzy
|
|
|
|
|
#~ msgid "See :pep:`613` for more details about explicit type aliases."
|
|
|
|
|
#~ msgstr "Voir la :pep:`484` pour plus de détails."
|
|
|
|
|
|
|
|
|
|
#~ msgid ""
|
|
|
|
|
#~ "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[()]``."
|
|
|
|
|
#~ msgstr ""
|
|
|
|
|
#~ "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[()]``."
|
|
|
|
|
|
|
|
|
|
#~ 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."
|
|
|
|
|
|
|
|
|
|
#~ msgid ""
|
|
|
|
|
#~ "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`."
|
|
|
|
|
#~ msgstr ""
|
|
|
|
|
#~ "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`."
|
|
|
|
|
|
|
|
|
|
#~ msgid "Optional type."
|
|
|
|
|
#~ msgstr "Type « optionnel »."
|
|
|
|
|
|
|
|
|
|
#~ 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``."
|
|
|
|
|
|
|
|
|
|
#~ 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`."
|
|
|
|
|
|
|
|
|
|
#~ 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 ""
|
|
|
|
|
#~ "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 types "
|
|
|
|
|
#~ "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 mère 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`."
|
|
|
|
|
|
|
|
|
|
#~ 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 ::"
|
|
|
|
|
|
|
|
|
|
#~ msgid ""
|
|
|
|
|
#~ "At runtime, ``isinstance(x, T)`` will raise :exc:`TypeError`. In "
|
|
|
|
|
#~ "general, :func:`isinstance` and :func:`issubclass` should not be used "
|
|
|
|
|
#~ "with types."
|
|
|
|
|
#~ msgstr ""
|
|
|
|
|
#~ "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."
|
|
|
|
|
|
|
|
|
|
#, fuzzy
|
|
|
|
|
#~ msgid ""
|
|
|
|
|
#~ "See :pep:`692` for more details on using ``Unpack`` for ``**kwargs`` "
|
|
|
|
|
#~ "typing."
|
|
|
|
|
#~ msgstr "Voir la :pep:`484` pour plus de détails."
|
|
|
|
|
|
|
|
|
|
#, fuzzy
|
|
|
|
|
#~ msgid ""
|
|
|
|
|
#~ "``AnyStr`` is a :class:`constrained type variable <TypeVar>` defined as "
|
|
|
|
|
#~ "``AnyStr = TypeVar('AnyStr', str, bytes)``."
|
|
|
|
|
#~ msgstr ""
|
|
|
|
|
#~ "``AnyStr`` est une variable de type définie comme ``AnyStr = "
|
|
|
|
|
#~ "TypeVar('AnyStr', str, bytes)``."
|
|
|
|
|
|
|
|
|
|
#~ msgid ""
|
|
|
|
|
#~ "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`."
|
|
|
|
|
#~ msgstr ""
|
|
|
|
|
#~ "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`."
|
|
|
|
|
|
|
|
|
|
#~ msgid ""
|
|
|
|
|
#~ "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`."
|
|
|
|
|
#~ msgstr ""
|
|
|
|
|
#~ "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`."
|
|
|
|
|
|
|
|
|
|
#, fuzzy
|
|
|
|
|
#~ msgid "Abstract Base Classes"
|
|
|
|
|
#~ msgstr "Classe de base abstraite pour les types génériques."
|
|
|
|
|
|
|
|
|
|
#~ msgid "A generic version of :class:`collections.abc.Set`."
|
|
|
|
|
#~ msgstr "Une version générique de :class:`collections.abc.Set`."
|
|
|
|
|
|
|
|
|
|
#~ msgid "A generic version of :class:`collections.abc.ByteString`."
|
|
|
|
|
#~ msgstr "Une version générique de :class:`collections.abc.ByteString`."
|
|
|
|
|
|
|
|
|
|
#~ msgid ""
|
|
|
|
|
#~ "As a shorthand for this type, :class:`bytes` can be used to annotate "
|
|
|
|
|
#~ "arguments of any of the types mentioned above."
|
|
|
|
|
#~ msgstr ""
|
|
|
|
|
#~ "Comme abréviation pour ce type, :class:`bytes` peut être utilisé pour "
|
|
|
|
|
#~ "annoter des arguments de n'importe quel type mentionné ci-dessus."
|
|
|
|
|
|
|
|
|
|
#, fuzzy
|
|
|
|
|
#~ msgid ""
|
|
|
|
|
#~ ":class:`collections.abc.ByteString` now supports subscripting (``[]``). "
|
|
|
|
|
#~ "See :pep:`585` and :ref:`types-genericalias`."
|
|
|
|
|
#~ msgstr ""
|
|
|
|
|
#~ ":class:`collections.abc.ByteString` prend désormais en charge ``[]``. "
|
|
|
|
|
#~ "Voir :pep:`585` et :ref:`types-genericalias`."
|
|
|
|
|
|
|
|
|
|
#~ msgid "A generic version of :class:`collections.abc.Container`."
|
|
|
|
|
#~ msgstr "Une version générique de :class:`collections.abc.Container`."
|
|
|
|
|
|
|
|
|
|
#~ msgid "A generic version of :class:`collections.abc.ItemsView`."
|
|
|
|
|
#~ msgstr "Une version générique de :class:`collections.abc.ItemsView`."
|
|
|
|
|
|
|
|
|
|
#~ msgid "A generic version of :class:`collections.abc.KeysView`."
|
|
|
|
|
#~ msgstr "Une version générique de :class:`collections.abc.KeysView`."
|
|
|
|
|
|
|
|
|
|
#~ msgid ""
|
|
|
|
|
#~ "A generic version of :class:`collections.abc.Mapping`. This type can be "
|
|
|
|
|
#~ "used as follows::"
|
|
|
|
|
#~ msgstr ""
|
|
|
|
|
#~ "Une version générique de :class:`collections.abc.Mapping`. Ce type peut "
|
|
|
|
|
#~ "être utilisé comme suit ::"
|
|
|
|
|
|
|
|
|
|
#~ msgid "A generic version of :class:`collections.abc.MutableSet`."
|
|
|
|
|
#~ msgstr "Une version générique de :class:`collections.abc.MutableSet`."
|
|
|
|
|
|
|
|
|
|
#~ msgid "A generic version of :class:`collections.abc.Sequence`."
|
|
|
|
|
#~ msgstr "Une version générique de :class:`collections.abc.Sequence`."
|
|
|
|
|
|
|
|
|
|
#~ msgid "A generic version of :class:`collections.abc.Iterable`."
|
|
|
|
|
#~ msgstr "Une version générique de :class:`collections.abc.Iterable`."
|
|
|
|
|
|
|
|
|
|
#, fuzzy
|
|
|
|
|
#~ msgid "Use :class:`collections.abc.Hashable` directly instead."
|
|
|
|
|
#~ msgstr "Un alias pour :class:`collections.abc.Hashable`"
|
|
|
|
|
|
|
|
|
|
#~ msgid "A generic version of :class:`collections.abc.Reversible`."
|
|
|
|
|
#~ msgstr "Une version générique de :class:`collections.abc.Reversible`."
|
|
|
|
|
|
|
|
|
|
#, fuzzy
|
|
|
|
|
#~ msgid "Use :class:`collections.abc.Sized` directly instead."
|
|
|
|
|
#~ msgstr "Un alias pour :class:`collections.abc.Sized`"
|
|
|
|
|
|
|
|
|
|
#~ msgid "Asynchronous programming"
|
|
|
|
|
#~ msgstr "Programmation asynchrone"
|
|
|
|
|
|
|
|
|
|
#~ msgid "A generic version of :class:`collections.abc.Awaitable`."
|
|
|
|
|
#~ msgstr "Une version générique de :class:`collections.abc.Awaitable`."
|
|
|
|
|
|
|
|
|
|
#~ msgid "Context manager types"
|
|
|
|
|
#~ msgstr "Types associés aux gestionnaires de contexte"
|
|
|
|
|
|
|
|
|
|
#~ msgid ""
|
|
|
|
|
#~ "``order_default`` indicates whether the ``order`` parameter is assumed to "
|
|
|
|
|
#~ "be True or False if it is omitted by the caller."
|
|
|
|
|
#~ msgstr ""
|
|
|
|
|
#~ "``order_default`` indique la valeur du paramètre ``order`` (``True`` ou "
|
|
|
|
|
#~ "``False``) si ce n'est pas précisé lors de l'appel."
|
|
|
|
|
|
|
|
|
|
#~ msgid ""
|
|
|
|
|
#~ "``kw_only_default`` indicates whether the ``kw_only`` parameter is "
|
|
|
|
|
#~ "assumed to be True or False if it is omitted by the caller."
|
|
|
|
|
#~ msgstr ""
|
|
|
|
|
#~ "``kw_only_default`` indique la valeur du paramètre ``kw_only_default`` "
|
|
|
|
|
#~ "(``True`` ou ``False``) si ce ne n'est pas précisé lors de l'appel."
|
|
|
|
|
|
|
|
|
|
#, fuzzy
|
|
|
|
|
#~ msgid ""
|
|
|
|
|
#~ "``frozen_default`` indicates whether the ``frozen`` parameter is assumed "
|
|
|
|
|
#~ "to be True or False if it is omitted by the caller."
|
|
|
|
|
#~ msgstr ""
|
|
|
|
|
#~ "``order_default`` indique la valeur du paramètre ``order`` (``True`` ou "
|
|
|
|
|
#~ "``False``) si ce n'est pas précisé lors de l'appel."
|
|
|
|
|
|
|
|
|
|
#~ msgid "``factory`` is an alias for ``default_factory``."
|
|
|
|
|
#~ msgstr "``factory`` est un alias pour ``default_factory``."
|
|
|
|
|
|
|
|
|
|
#~ msgid "This mutates the function(s) in place."
|
|
|
|
|
#~ msgstr "Cela fait muter la ou les fonctions en place."
|
|
|
|
|
|
|
|
|
|
#, fuzzy
|
|
|
|
|
#~ msgid "There is no runtime checking of this property."
|
|
|
|
|
#~ msgstr ""
|
|
|
|
|
#~ "Ces propriétés ne sont pas vérifiées à l'exécution. Voir la :pep:`591` "
|
|
|
|
|
#~ "pour plus de détails."
|
|
|
|
|
|
|
|
|
|
#, fuzzy
|
|
|
|
|
#~ msgid ""
|
|
|
|
|
#~ "The decorator will set the ``__override__`` attribute to ``True`` on the "
|
|
|
|
|
#~ "decorated object. Thus, a check like ``if getattr(obj, \"__override__\", "
|
|
|
|
|
#~ "False)`` can be used at runtime to determine whether an object ``obj`` "
|
|
|
|
|
#~ "has been marked as an override. If the decorated object does not support "
|
|
|
|
|
#~ "setting attributes, the decorator returns the object unchanged without "
|
|
|
|
|
#~ "raising an exception."
|
|
|
|
|
#~ msgstr ""
|
|
|
|
|
#~ "Le décorateur met l'attribut ``__final__`` à ``True`` de l'objet décoré. "
|
|
|
|
|
#~ "Cela permet d'utiliser une vérification comme ``if getattr(obj, "
|
|
|
|
|
#~ "\"__final__\", False)`` durant l'exécution afin de vérifier si un objet "
|
|
|
|
|
#~ "``obj`` est décoré comme ``final``. Dans le cas où l'objet décoré ne "
|
|
|
|
|
#~ "supporte pas la modification d'attributs, le décorateur retournera "
|
|
|
|
|
#~ "l'objet de base sans lever d'exception."
|
|
|
|
|
|
|
|
|
|
#, fuzzy
|
|
|
|
|
#~ msgid "See :pep:`698` for more details."
|
|
|
|
|
#~ msgstr "Voir la :pep:`484` pour plus de détails."
|
|
|
|
|
|
|
|
|
|
#~ msgid ""
|
|
|
|
|
#~ "Provide basic introspection for generic types and special typing forms."
|
|
|
|
|
#~ msgstr ""
|
|
|
|
|
#~ "Fournit une introspection de base pour les types génériques et les formes "
|
|
|
|
|
#~ "spéciales de typage."
|
|
|
|
|
|
|
|
|
|
#, fuzzy
|
|
|
|
|
#~ msgid "``typing.Hashable`` and ``typing.Sized``"
|
|
|
|
|
#~ msgstr "sous-modules ``typing.io`` et ``typing.re``"
|
|
|
|
|
|
2023-07-23 12:39:39 +00:00
|
|
|
|
#~ msgid ""
|
|
|
|
|
#~ "Note that ``None`` as a type hint is a special case and is replaced by "
|
|
|
|
|
#~ "``type(None)``."
|
|
|
|
|
#~ msgstr ""
|
|
|
|
|
#~ "Notez que ``None`` comme annotation de type est un cas particulier et est "
|
|
|
|
|
#~ "remplacé par ``type(None)``."
|
|
|
|
|
|
|
|
|
|
#~ msgid "Callable"
|
|
|
|
|
#~ msgstr "Appelable"
|
|
|
|
|
|
|
|
|
|
#~ msgid ""
|
|
|
|
|
#~ "Frameworks expecting callback functions of specific signatures might be "
|
|
|
|
|
#~ "type hinted using ``Callable[[Arg1Type, Arg2Type], ReturnType]``."
|
|
|
|
|
#~ msgstr ""
|
|
|
|
|
#~ "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]``."
|
|
|
|
|
|
|
|
|
|
#~ 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 ""
|
|
|
|
|
#~ "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]``."
|
|
|
|
|
|
|
|
|
|
#, fuzzy
|
|
|
|
|
#~ msgid "See :pep:`613` for more details about explicit type aliases."
|
|
|
|
|
#~ msgstr "Voir la :pep:`484` pour plus de détails."
|
|
|
|
|
|
|
|
|
|
#~ msgid ""
|
|
|
|
|
#~ "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[()]``."
|
|
|
|
|
#~ msgstr ""
|
|
|
|
|
#~ "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[()]``."
|
|
|
|
|
|
|
|
|
|
#~ 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."
|
|
|
|
|
|
|
|
|
|
#~ msgid ""
|
|
|
|
|
#~ "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`."
|
|
|
|
|
#~ msgstr ""
|
|
|
|
|
#~ "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`."
|
|
|
|
|
|
|
|
|
|
#~ msgid "Optional type."
|
|
|
|
|
#~ msgstr "Type « optionnel »."
|
|
|
|
|
|
|
|
|
|
#~ 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``."
|
|
|
|
|
|
|
|
|
|
#~ 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`."
|
|
|
|
|
|
|
|
|
|
#~ 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 ""
|
|
|
|
|
#~ "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 types "
|
|
|
|
|
#~ "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 mère 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`."
|
|
|
|
|
|
|
|
|
|
#~ 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 ::"
|
|
|
|
|
|
|
|
|
|
#~ msgid ""
|
|
|
|
|
#~ "At runtime, ``isinstance(x, T)`` will raise :exc:`TypeError`. In "
|
|
|
|
|
#~ "general, :func:`isinstance` and :func:`issubclass` should not be used "
|
|
|
|
|
#~ "with types."
|
|
|
|
|
#~ msgstr ""
|
|
|
|
|
#~ "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."
|
|
|
|
|
|
|
|
|
|
#, fuzzy
|
|
|
|
|
#~ msgid ""
|
|
|
|
|
#~ "``AnyStr`` is a :class:`constrained type variable <TypeVar>` defined as "
|
|
|
|
|
#~ "``AnyStr = TypeVar('AnyStr', str, bytes)``."
|
|
|
|
|
#~ msgstr ""
|
|
|
|
|
#~ "``AnyStr`` est une variable de type définie comme ``AnyStr = "
|
|
|
|
|
#~ "TypeVar('AnyStr', str, bytes)``."
|
|
|
|
|
|
|
|
|
|
#~ msgid ""
|
|
|
|
|
#~ "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`."
|
|
|
|
|
#~ msgstr ""
|
|
|
|
|
#~ "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`."
|
|
|
|
|
|
|
|
|
|
#~ msgid ""
|
|
|
|
|
#~ "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`."
|
|
|
|
|
#~ msgstr ""
|
|
|
|
|
#~ "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`."
|
|
|
|
|
|
|
|
|
|
#, fuzzy
|
|
|
|
|
#~ msgid "Abstract Base Classes"
|
|
|
|
|
#~ msgstr "Classe de base abstraite pour les types génériques."
|
|
|
|
|
|
|
|
|
|
#~ msgid "A generic version of :class:`collections.abc.Set`."
|
|
|
|
|
#~ msgstr "Une version générique de :class:`collections.abc.Set`."
|
|
|
|
|
|
|
|
|
|
#~ msgid "A generic version of :class:`collections.abc.ByteString`."
|
|
|
|
|
#~ msgstr "Une version générique de :class:`collections.abc.ByteString`."
|
|
|
|
|
|
|
|
|
|
#~ msgid ""
|
|
|
|
|
#~ "As a shorthand for this type, :class:`bytes` can be used to annotate "
|
|
|
|
|
#~ "arguments of any of the types mentioned above."
|
|
|
|
|
#~ msgstr ""
|
|
|
|
|
#~ "Comme abréviation pour ce type, :class:`bytes` peut être utilisé pour "
|
|
|
|
|
#~ "annoter des arguments de n'importe quel type mentionné ci-dessus."
|
|
|
|
|
|
|
|
|
|
#, fuzzy
|
|
|
|
|
#~ msgid ""
|
|
|
|
|
#~ ":class:`collections.abc.ByteString` now supports subscripting (``[]``). "
|
|
|
|
|
#~ "See :pep:`585` and :ref:`types-genericalias`."
|
|
|
|
|
#~ msgstr ""
|
|
|
|
|
#~ ":class:`collections.abc.ByteString` prend désormais en charge ``[]``. "
|
|
|
|
|
#~ "Voir :pep:`585` et :ref:`types-genericalias`."
|
|
|
|
|
|
|
|
|
|
#~ msgid "A generic version of :class:`collections.abc.Container`."
|
|
|
|
|
#~ msgstr "Une version générique de :class:`collections.abc.Container`."
|
|
|
|
|
|
|
|
|
|
#~ msgid "A generic version of :class:`collections.abc.ItemsView`."
|
|
|
|
|
#~ msgstr "Une version générique de :class:`collections.abc.ItemsView`."
|
|
|
|
|
|
|
|
|
|
#~ msgid "A generic version of :class:`collections.abc.KeysView`."
|
|
|
|
|
#~ msgstr "Une version générique de :class:`collections.abc.KeysView`."
|
|
|
|
|
|
|
|
|
|
#~ msgid ""
|
|
|
|
|
#~ "A generic version of :class:`collections.abc.Mapping`. This type can be "
|
|
|
|
|
#~ "used as follows::"
|
|
|
|
|
#~ msgstr ""
|
|
|
|
|
#~ "Une version générique de :class:`collections.abc.Mapping`. Ce type peut "
|
|
|
|
|
#~ "être utilisé comme suit ::"
|
|
|
|
|
|
|
|
|
|
#~ msgid "A generic version of :class:`collections.abc.MutableSet`."
|
|
|
|
|
#~ msgstr "Une version générique de :class:`collections.abc.MutableSet`."
|
|
|
|
|
|
|
|
|
|
#~ msgid "A generic version of :class:`collections.abc.Sequence`."
|
|
|
|
|
#~ msgstr "Une version générique de :class:`collections.abc.Sequence`."
|
|
|
|
|
|
|
|
|
|
#~ msgid "A generic version of :class:`collections.abc.Iterable`."
|
|
|
|
|
#~ msgstr "Une version générique de :class:`collections.abc.Iterable`."
|
|
|
|
|
|
|
|
|
|
#~ msgid "A generic version of :class:`collections.abc.Reversible`."
|
|
|
|
|
#~ msgstr "Une version générique de :class:`collections.abc.Reversible`."
|
|
|
|
|
|
|
|
|
|
#~ msgid "Asynchronous programming"
|
|
|
|
|
#~ msgstr "Programmation asynchrone"
|
|
|
|
|
|
|
|
|
|
#~ msgid "A generic version of :class:`collections.abc.Awaitable`."
|
|
|
|
|
#~ msgstr "Une version générique de :class:`collections.abc.Awaitable`."
|
|
|
|
|
|
|
|
|
|
#~ msgid "Context manager types"
|
|
|
|
|
#~ msgstr "Types associés aux gestionnaires de contexte"
|
|
|
|
|
|
|
|
|
|
#~ msgid ""
|
|
|
|
|
#~ "``order_default`` indicates whether the ``order`` parameter is assumed to "
|
|
|
|
|
#~ "be True or False if it is omitted by the caller."
|
|
|
|
|
#~ msgstr ""
|
|
|
|
|
#~ "``order_default`` indique la valeur du paramètre ``order`` (``True`` ou "
|
|
|
|
|
#~ "``False``) si ce n'est pas précisé lors de l'appel."
|
|
|
|
|
|
|
|
|
|
#~ msgid ""
|
|
|
|
|
#~ "``kw_only_default`` indicates whether the ``kw_only`` parameter is "
|
|
|
|
|
#~ "assumed to be True or False if it is omitted by the caller."
|
|
|
|
|
#~ msgstr ""
|
|
|
|
|
#~ "``kw_only_default`` indique la valeur du paramètre ``kw_only_default`` "
|
|
|
|
|
#~ "(``True`` ou ``False``) si ce ne n'est pas précisé lors de l'appel."
|
|
|
|
|
|
|
|
|
|
#~ msgid "``factory`` is an alias for ``default_factory``."
|
|
|
|
|
#~ msgstr "``factory`` est un alias pour ``default_factory``."
|
|
|
|
|
|
|
|
|
|
#~ msgid "This mutates the function(s) in place."
|
|
|
|
|
#~ msgstr "Cela fait muter la ou les fonctions en place."
|
|
|
|
|
|
|
|
|
|
#~ msgid ""
|
|
|
|
|
#~ "Provide basic introspection for generic types and special typing forms."
|
|
|
|
|
#~ msgstr ""
|
|
|
|
|
#~ "Fournit une introspection de base pour les types génériques et les formes "
|
|
|
|
|
#~ "spéciales de typage."
|
|
|
|
|
|
2022-03-23 17:40:12 +00:00
|
|
|
|
#~ 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`."
|
|
|
|
|
|
2021-09-24 08:20:01 +00:00
|
|
|
|
#~ msgid ""
|
|
|
|
|
#~ "This also means that it is not possible to create a subtype of "
|
|
|
|
|
#~ "``Derived`` since it is an identity function at runtime, not an actual "
|
|
|
|
|
#~ "type::"
|
|
|
|
|
#~ msgstr ""
|
|
|
|
|
#~ "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 ::"
|
|
|
|
|
|
|
|
|
|
#~ 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]``."
|
|
|
|
|
|
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 !"
|