Translating extending/newtypes_tutorial.po (#1605)

Automerge of PR #1605 by @JulienPalard

Je pense que je vais m'arrêter là pour le moment sur ce fichier, si j'attaque le reste ce sera pour une autre péèrre.
This commit is contained in:
Julien Palard 2021-09-25 16:12:09 +02:00 committed by GitHub
parent 3392ebaa93
commit ec12a7bae6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 107 additions and 7 deletions

View File

@ -6,8 +6,8 @@ msgstr ""
"Project-Id-Version: Python 3\n" "Project-Id-Version: Python 3\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-09-23 16:16+0200\n" "POT-Creation-Date: 2021-09-23 16:16+0200\n"
"PO-Revision-Date: 2018-06-17 10:15+0200\n" "PO-Revision-Date: 2021-09-25 11:25+0200\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: Julien Palard <julien@palard.fr>\n"
"Language-Team: FRENCH <traductions@lists.afpy.org>\n" "Language-Team: FRENCH <traductions@lists.afpy.org>\n"
"Language: fr\n" "Language: fr\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@ -16,7 +16,7 @@ msgstr ""
#: extending/newtypes_tutorial.rst:7 #: extending/newtypes_tutorial.rst:7
msgid "Defining Extension Types: Tutorial" msgid "Defining Extension Types: Tutorial"
msgstr "" msgstr "Tutoriel : définir des types dans des extensions"
#: extending/newtypes_tutorial.rst:14 #: extending/newtypes_tutorial.rst:14
msgid "" msgid ""
@ -26,10 +26,15 @@ msgid ""
"pattern, but there are some details that you need to understand before you " "pattern, but there are some details that you need to understand before you "
"can get started. This document is a gentle introduction to the topic." "can get started. This document is a gentle introduction to the topic."
msgstr "" msgstr ""
"Python permet à l'auteur d'un module d'extension C de définir de nouveaux "
"types qui peuvent être manipulés depuis du code Python, à la manière des "
"types natifs :class:`str` et :class:`list`. Les implémentations de tous les "
"types d'extension ont des similarités, mais quelques subtilités doivent être "
"abordées avant de commencer."
#: extending/newtypes_tutorial.rst:24 #: extending/newtypes_tutorial.rst:24
msgid "The Basics" msgid "The Basics"
msgstr "" msgstr "Les bases"
#: extending/newtypes_tutorial.rst:26 #: extending/newtypes_tutorial.rst:26
msgid "" msgid ""
@ -42,12 +47,23 @@ msgid ""
"an object, a method called, or it is multiplied by another object. These C " "an object, a method called, or it is multiplied by another object. These C "
"functions are called \"type methods\"." "functions are called \"type methods\"."
msgstr "" msgstr ""
":term:`CPython` considère que tous les objets Python sont des variables de "
"type :c:type:`PyObject\\*`, qui sert de type de base pour tous les objets "
"Python. La structure de :c:type:`PyObject` ne contient que le :term:"
"`compteur de références <reference count>` et un pointeur vers un objet de "
"type « type de l'objet ». C'est ici que tout se joue : l'objet type "
"détermine quelle fonction C doit être appelée par l'interpréteur quand, par "
"exemple, un attribut est recherché sur un objet, quand une méthode est "
"appelée, ou quand l'objet est multiplié par un autre objet. Ces fonctions C "
"sont appelées des « méthodes de type »."
#: extending/newtypes_tutorial.rst:35 #: extending/newtypes_tutorial.rst:35
msgid "" msgid ""
"So, if you want to define a new extension type, you need to create a new " "So, if you want to define a new extension type, you need to create a new "
"type object." "type object."
msgstr "" msgstr ""
"Donc, pour définir un nouveau type dans une extension, vous devez créer un "
"nouvel objet type."
#: extending/newtypes_tutorial.rst:38 #: extending/newtypes_tutorial.rst:38
msgid "" msgid ""
@ -55,6 +71,9 @@ msgid ""
"but complete, module that defines a new type named :class:`Custom` inside a " "but complete, module that defines a new type named :class:`Custom` inside a "
"C extension module :mod:`custom`:" "C extension module :mod:`custom`:"
msgstr "" msgstr ""
"Ce genre de chose ne s'explique correctement qu'avec des exemples, voici "
"donc un module minimaliste mais suffisant qui définit un nouveau type nommé :"
"class:`Custom` dans le module d'extension :mod:`custom` : "
#: extending/newtypes_tutorial.rst:43 #: extending/newtypes_tutorial.rst:43
msgid "" msgid ""
@ -63,18 +82,27 @@ msgid ""
"allows defining heap-allocated extension types using the :c:func:" "allows defining heap-allocated extension types using the :c:func:"
"`PyType_FromSpec` function, which isn't covered in this tutorial." "`PyType_FromSpec` function, which isn't covered in this tutorial."
msgstr "" msgstr ""
"Ce qui est montré ici est la manière traditionnelle de définir des types "
"d'extension *statiques*, et cela convient dans la majorité des cas. L'API C "
"permet aussi de définir des types alloués sur le tas, via la fonction :c:"
"func:`PyType_FromSpec`, mais ce n'est pas couvert par ce tutoriel."
#: extending/newtypes_tutorial.rst:50 #: extending/newtypes_tutorial.rst:50
msgid "" msgid ""
"Now that's quite a bit to take in at once, but hopefully bits will seem " "Now that's quite a bit to take in at once, but hopefully bits will seem "
"familiar from the previous chapter. This file defines three things:" "familiar from the previous chapter. This file defines three things:"
msgstr "" msgstr ""
"C'est un peu long, mais vous devez déjà reconnaître quelques morceaux "
"expliqués au chapitre précédent. Ce fichier définit trois choses :"
#: extending/newtypes_tutorial.rst:53 #: extending/newtypes_tutorial.rst:53
msgid "" msgid ""
"What a :class:`Custom` **object** contains: this is the ``CustomObject`` " "What a :class:`Custom` **object** contains: this is the ``CustomObject`` "
"struct, which is allocated once for each :class:`Custom` instance." "struct, which is allocated once for each :class:`Custom` instance."
msgstr "" msgstr ""
"Ce qu'un **objet** :class:`Custom` contient : c'est la structure "
"``CustomObject``, qui est allouée une fois pour chaque instance de :class:"
"`Custom`."
#: extending/newtypes_tutorial.rst:55 #: extending/newtypes_tutorial.rst:55
msgid "" msgid ""
@ -82,16 +110,21 @@ msgid ""
"which defines a set of flags and function pointers that the interpreter " "which defines a set of flags and function pointers that the interpreter "
"inspects when specific operations are requested." "inspects when specific operations are requested."
msgstr "" msgstr ""
"Comment le **type** :class:`Custom` se comporte : c'est la structure "
"``CustomType``, qui définit l'ensemble des options et pointeurs de fonction "
"utilisés par l'interpréteur."
#: extending/newtypes_tutorial.rst:58 #: extending/newtypes_tutorial.rst:58
msgid "" msgid ""
"How to initialize the :mod:`custom` module: this is the ``PyInit_custom`` " "How to initialize the :mod:`custom` module: this is the ``PyInit_custom`` "
"function and the associated ``custommodule`` struct." "function and the associated ``custommodule`` struct."
msgstr "" msgstr ""
"Comment initialiser le module :mod:`custom` : c'est la fonction "
"``PyInit_custom`` et la structure associée ``custommodule``."
#: extending/newtypes_tutorial.rst:61 #: extending/newtypes_tutorial.rst:61
msgid "The first bit is::" msgid "The first bit is::"
msgstr "" msgstr "Commençons par ::"
#: extending/newtypes_tutorial.rst:67 #: extending/newtypes_tutorial.rst:67
msgid "" msgid ""
@ -103,12 +136,22 @@ msgid ""
"abstract away the layout and to enable additional fields in :ref:`debug " "abstract away the layout and to enable additional fields in :ref:`debug "
"builds <debug-build>`." "builds <debug-build>`."
msgstr "" msgstr ""
"C'est ce qu'un objet ``Custom`` contient. ``PyObject_HEAD`` est "
"obligatoirement au début de chaque structure d'objet et définit un champ "
"appelé ``ob_base`` de type :c:type:`PyObject`, contenant un pointeur vers un "
"objet type et un compteur de références (on peut y accéder en utilisant les "
"macros :c:macro:`Py_TYPE` et :c:macro:`Py_REFCNT`, respectivement). La "
"raison d'être de ces macros est d'abstraire l'agencement de la structure, et "
"ainsi de permettre l'ajout de champs en :ref:`mode débogage <debug-build>`."
#: extending/newtypes_tutorial.rst:76 #: extending/newtypes_tutorial.rst:76
msgid "" msgid ""
"There is no semicolon above after the :c:macro:`PyObject_HEAD` macro. Be " "There is no semicolon above after the :c:macro:`PyObject_HEAD` macro. Be "
"wary of adding one by accident: some compilers will complain." "wary of adding one by accident: some compilers will complain."
msgstr "" msgstr ""
"Il n'y a pas de point-virgule après la macro :c:macro:`PyObject_HEAD`. "
"Attention à ne pas l'ajouter par accident : certains compilateurs pourraient "
"s'en plaindre."
#: extending/newtypes_tutorial.rst:79 #: extending/newtypes_tutorial.rst:79
msgid "" msgid ""
@ -116,10 +159,13 @@ msgid ""
"``PyObject_HEAD`` boilerplate; for example, here is the definition for " "``PyObject_HEAD`` boilerplate; for example, here is the definition for "
"standard Python floats::" "standard Python floats::"
msgstr "" msgstr ""
"Bien sûr, les objets ajoutent généralement des données supplémentaires après "
"l'entête standard ``PyObject_HEAD``. Par exemple voici la définition du type "
"standard Python ``float`` ::"
#: extending/newtypes_tutorial.rst:88 #: extending/newtypes_tutorial.rst:88
msgid "The second bit is the definition of the type object. ::" msgid "The second bit is the definition of the type object. ::"
msgstr "" msgstr "La deuxième partie est la définition de l'objet type ::"
#: extending/newtypes_tutorial.rst:101 #: extending/newtypes_tutorial.rst:101
msgid "" msgid ""
@ -127,6 +173,10 @@ msgid ""
"listing all the :c:type:`PyTypeObject` fields that you don't care about and " "listing all the :c:type:`PyTypeObject` fields that you don't care about and "
"also to avoid caring about the fields' declaration order." "also to avoid caring about the fields' declaration order."
msgstr "" msgstr ""
"Nous recommandons d'utiliser la syntaxe d'initialisation nommée (C99) pour "
"remplir la structure, comme ci-dessus, afin d'éviter d'avoir à lister les "
"champs de :c:type:`PyTypeObject` dont vous n'avez pas besoin, et de ne pas "
"vous soucier de leur ordre."
#: extending/newtypes_tutorial.rst:105 #: extending/newtypes_tutorial.rst:105
msgid "" msgid ""
@ -135,22 +185,31 @@ msgid ""
"fields will be filled with zeros by the C compiler, and it's common practice " "fields will be filled with zeros by the C compiler, and it's common practice "
"to not specify them explicitly unless you need them." "to not specify them explicitly unless you need them."
msgstr "" msgstr ""
"La définition de :c:type:`PyTypeObject` dans :file:`object.h` contient en "
"fait bien plus de :ref:`champs <type-structs>` que la définition ci-dessus. "
"Les champs restants sont mis à zéro par le compilateur C, et c'est une "
"pratique répandue de ne pas spécifier les champs dont vous n'avez pas besoin."
#: extending/newtypes_tutorial.rst:110 #: extending/newtypes_tutorial.rst:110
msgid "We're going to pick it apart, one field at a time::" msgid "We're going to pick it apart, one field at a time::"
msgstr "" msgstr "Regardons les champs de cette structure, un par un ::"
#: extending/newtypes_tutorial.rst:114 #: extending/newtypes_tutorial.rst:114
msgid "" msgid ""
"This line is mandatory boilerplate to initialize the ``ob_base`` field " "This line is mandatory boilerplate to initialize the ``ob_base`` field "
"mentioned above. ::" "mentioned above. ::"
msgstr "" msgstr ""
"Cette ligne, obligatoire, initialise le champ ``ob_base`` mentionné "
"précédemment."
#: extending/newtypes_tutorial.rst:119 #: extending/newtypes_tutorial.rst:119
msgid "" msgid ""
"The name of our type. This will appear in the default textual " "The name of our type. This will appear in the default textual "
"representation of our objects and in some error messages, for example:" "representation of our objects and in some error messages, for example:"
msgstr "" msgstr ""
"C'est le nom de notre type. Il apparaît dans la représentation textuelle par "
"défaut de nos objets, ainsi que dans quelques messages d'erreur, par "
"exemple :"
#: extending/newtypes_tutorial.rst:129 #: extending/newtypes_tutorial.rst:129
msgid "" msgid ""
@ -160,6 +219,11 @@ msgid ""
"`custom.Custom`. Using the real dotted import path is important to make your " "`custom.Custom`. Using the real dotted import path is important to make your "
"type compatible with the :mod:`pydoc` and :mod:`pickle` modules. ::" "type compatible with the :mod:`pydoc` and :mod:`pickle` modules. ::"
msgstr "" msgstr ""
"Notez que le nom comporte un point : il inclut le nom du module et le nom du "
"type. Dans ce cas le module est :mod:`custom`, et le type est :class:"
"`Custom`, donc nous donnons comme nom :class:`custom.Custom`. Nommer "
"correctement son type, avec le point, est important pour le rendre "
"compatible avec :mod:`pydoc` et :mod:`pickle`. ::"
#: extending/newtypes_tutorial.rst:138 #: extending/newtypes_tutorial.rst:138
msgid "" msgid ""
@ -167,6 +231,10 @@ msgid ""
"class:`Custom` instances. :c:member:`~PyTypeObject.tp_itemsize` is only " "class:`Custom` instances. :c:member:`~PyTypeObject.tp_itemsize` is only "
"used for variable-sized objects and should otherwise be zero." "used for variable-sized objects and should otherwise be zero."
msgstr "" msgstr ""
"C'est pour que Python sache combien de mémoire allouer à la création d'une "
"nouvelle instance de :class:`Custom`. :c:member:`~PyTypeObject.tp_itemsize` "
"n'est utilisé que pour les objets de taille variable, sinon il doit rester à "
"zéro."
#: extending/newtypes_tutorial.rst:144 #: extending/newtypes_tutorial.rst:144
msgid "" msgid ""
@ -181,10 +249,22 @@ msgid ""
"type will be :class:`object`, or else you will be adding data members to " "type will be :class:`object`, or else you will be adding data members to "
"your base type, and therefore increasing its size." "your base type, and therefore increasing its size."
msgstr "" msgstr ""
"Si vous voulez qu'une classe en Python puisse hériter de votre type, et que "
"votre type a le même :c:member:`~PyTypeObject.tp_basicsize` que son parent, "
"vous rencontrerez des problèmes avec l'héritage multiple. Une sous-classe "
"Python de votre type devra lister votre type en premier dans son :attr:"
"`~class.__bases__`, sans quoi elle ne sera pas capable d'appeler la méthode :"
"meth:`__new__` de votre type sans erreur. Vous pouvez éviter ce problème en "
"vous assurant que votre type a un :c:member:`~PyTypeObject.tp_basicsize` "
"plus grand que son parent. La plupart du temps ce sera vrai (soit son parent "
"sera :class:`object`, soit vous ajouterez des attributs à votre type, "
"augmentant ainsi sa taille)."
#: extending/newtypes_tutorial.rst:154 #: extending/newtypes_tutorial.rst:154
msgid "We set the class flags to :const:`Py_TPFLAGS_DEFAULT`. ::" msgid "We set the class flags to :const:`Py_TPFLAGS_DEFAULT`. ::"
msgstr "" msgstr ""
"On utilise la constante :const:`Py_TPFLAGS_DEFAULT` comme seule option de "
"type. ::"
#: extending/newtypes_tutorial.rst:158 #: extending/newtypes_tutorial.rst:158
msgid "" msgid ""
@ -192,11 +272,17 @@ msgid ""
"the members defined until at least Python 3.3. If you need further members, " "the members defined until at least Python 3.3. If you need further members, "
"you will need to OR the corresponding flags." "you will need to OR the corresponding flags."
msgstr "" msgstr ""
"Chaque type doit inclure cette constante dans ses options : elle active tous "
"les membres définis jusqu'à au moins Python 3.3. Si vous avez besoin de plus "
"de membres, vous pouvez la combiner à d'autres constantes avec un *ou* "
"binaire."
#: extending/newtypes_tutorial.rst:162 #: extending/newtypes_tutorial.rst:162
msgid "" msgid ""
"We provide a doc string for the type in :c:member:`~PyTypeObject.tp_doc`. ::" "We provide a doc string for the type in :c:member:`~PyTypeObject.tp_doc`. ::"
msgstr "" msgstr ""
"On fournit une *docstring* pour ce type via le membre :c:member:"
"`~PyTypeObject.tp_doc`. ::"
#: extending/newtypes_tutorial.rst:166 #: extending/newtypes_tutorial.rst:166
msgid "" msgid ""
@ -206,12 +292,19 @@ msgid ""
"use the default implementation provided by the API function :c:func:" "use the default implementation provided by the API function :c:func:"
"`PyType_GenericNew`. ::" "`PyType_GenericNew`. ::"
msgstr "" msgstr ""
"Pour permettre la création d'une instance, nous devons fournir un *handler* :"
"c:member:`~PyTypeObject.tp_new`, qui est l'équivalent de la méthode Python :"
"meth:`__new__`, mais elle a besoin d'être spécifiée explicitement. Dans ce "
"cas, on se contente de l'implémentation par défaut fournie par la fonction :"
"c:func:`PyType_GenericNew` de l'API."
#: extending/newtypes_tutorial.rst:173 #: extending/newtypes_tutorial.rst:173
msgid "" msgid ""
"Everything else in the file should be familiar, except for some code in :c:" "Everything else in the file should be familiar, except for some code in :c:"
"func:`PyInit_custom`::" "func:`PyInit_custom`::"
msgstr "" msgstr ""
"Le reste du fichier doit vous être familier, en dehors du code de :c:func:"
"`PyInit_custom` ::"
#: extending/newtypes_tutorial.rst:179 #: extending/newtypes_tutorial.rst:179
msgid "" msgid ""
@ -219,18 +312,25 @@ msgid ""
"the appropriate default values, including :attr:`ob_type` that we initially " "the appropriate default values, including :attr:`ob_type` that we initially "
"set to ``NULL``. ::" "set to ``NULL``. ::"
msgstr "" msgstr ""
"Il initialise le type :class:`Custom`, en assignant quelques membres à leurs "
"valeurs par défaut, tel que :attr:`ob_type` qui valait initialement "
"``NULL``. ::"
#: extending/newtypes_tutorial.rst:190 #: extending/newtypes_tutorial.rst:190
msgid "" msgid ""
"This adds the type to the module dictionary. This allows us to create :" "This adds the type to the module dictionary. This allows us to create :"
"class:`Custom` instances by calling the :class:`Custom` class:" "class:`Custom` instances by calling the :class:`Custom` class:"
msgstr "" msgstr ""
"Ici on ajoute le type au dictionnaire du module. Cela permet de créer une "
"instance de :class:`Custom` en appelant la classe :class:`Custom` :"
#: extending/newtypes_tutorial.rst:198 #: extending/newtypes_tutorial.rst:198
msgid "" msgid ""
"That's it! All that remains is to build it; put the above code in a file " "That's it! All that remains is to build it; put the above code in a file "
"called :file:`custom.c` and:" "called :file:`custom.c` and:"
msgstr "" msgstr ""
"C'est tout ! Il ne reste plus qu'à compiler, placez le code ci-dessus dans "
"un fichier :file:`custom.c` et :"
#: extending/newtypes_tutorial.rst:207 #: extending/newtypes_tutorial.rst:207
msgid "in a file called :file:`setup.py`; then typing" msgid "in a file called :file:`setup.py`; then typing"