forked from AFPy/python-docs-fr
rewrap pyporting.rst
This commit is contained in:
parent
d1b85cb97b
commit
1a8f4ce0f3
|
@ -180,8 +180,8 @@ msgid ""
|
|||
"your code to support Python 2 & 3 simultaneously."
|
||||
msgstr ""
|
||||
"Gardez ces points-clés en tête pendant que vous lisez les détails ci-dessous "
|
||||
" concernant le portage de votre code vers une compatibilité simultanée "
|
||||
"Python 2 et 3."
|
||||
"concernant le portage de votre code vers une compatibilité simultanée Python "
|
||||
"2 et 3."
|
||||
|
||||
#: ../Doc/howto/pyporting.rst:69
|
||||
msgid "Drop support for Python 2.6 and older"
|
||||
|
@ -222,10 +222,10 @@ msgid ""
|
|||
"But you should aim for only supporting Python 2.7. Python 2.6 is no longer "
|
||||
"freely supported and thus is not receiving bugfixes. This means **you** will "
|
||||
"have to work around any issues you come across with Python 2.6. There are "
|
||||
"also some tools mentioned in this HOWTO which do not support Python 2.6 "
|
||||
"(e.g., Pylint_), and this will become more commonplace as time goes on. It "
|
||||
"will simply be easier for you if you only support the versions of Python "
|
||||
"that you have to support."
|
||||
"also some tools mentioned in this HOWTO which do not support Python 2.6 (e."
|
||||
"g., Pylint_), and this will become more commonplace as time goes on. It will "
|
||||
"simply be easier for you if you only support the versions of Python that you "
|
||||
"have to support."
|
||||
msgstr ""
|
||||
"Mais nous vous conseillons de viser seulement un support de Python 2.7. "
|
||||
"Python 2.6 n'est plus supporté gratuitement et par conséquent ne reçoit plus "
|
||||
|
@ -241,17 +241,17 @@ msgstr ""
|
|||
msgid ""
|
||||
"Make sure you specify the proper version support in your ``setup.py`` file"
|
||||
msgstr ""
|
||||
"Assurez vous de spécifier la bonne version supportée dans le fichier "
|
||||
"``setup.py``"
|
||||
"Assurez vous de spécifier la bonne version supportée dans le fichier ``setup."
|
||||
"py``"
|
||||
|
||||
#: ../Doc/howto/pyporting.rst:94
|
||||
msgid ""
|
||||
"In your ``setup.py`` file you should have the proper `trove classifier`_ "
|
||||
"specifying what versions of Python you support. As your project does not "
|
||||
"support Python 3 yet you should at least have ``Programming Language :: "
|
||||
"Python :: 2 :: Only`` specified. Ideally you should also specify each "
|
||||
"major/minor version of Python that you do support, e.g. ``Programming "
|
||||
"Language :: Python :: 2.7``."
|
||||
"Python :: 2 :: Only`` specified. Ideally you should also specify each major/"
|
||||
"minor version of Python that you do support, e.g. ``Programming Language :: "
|
||||
"Python :: 2.7``."
|
||||
msgstr ""
|
||||
"Votre fichier ``setup.py`` devrait contenir le bon `trove classifier`_ "
|
||||
"spécifiant les versions de Python avec lesquelles vous êtes compatible. "
|
||||
|
@ -283,8 +283,8 @@ msgstr ""
|
|||
"ces derniers et non de votre code. Si vous souhaitez une valeur cible, "
|
||||
"essayez de dépasser les 80 % de couverture (et ne vous sentez pas coupable "
|
||||
"si vous trouvez difficile de faire mieux que 90 % de couverture). Si vous ne "
|
||||
" disposez pas encore d'un outil pour mesurer la couverture de code, "
|
||||
"coverage.py_ est recommandé."
|
||||
"disposez pas encore d'un outil pour mesurer la couverture de code, coverage."
|
||||
"py_ est recommandé."
|
||||
|
||||
#: ../Doc/howto/pyporting.rst:118
|
||||
msgid ""
|
||||
|
@ -367,11 +367,11 @@ msgid ""
|
|||
"manually to get full Python 3 support (which of these steps are necessary "
|
||||
"vary between the tools). Read the documentation for the tool you choose to "
|
||||
"use to see what it fixes by default and what it can do optionally to know "
|
||||
"what will (not) be fixed for you and what you may have to fix on your own "
|
||||
"(e.g. using ``io.open()`` over the built-in ``open()`` function is off by "
|
||||
"what will (not) be fixed for you and what you may have to fix on your own (e."
|
||||
"g. using ``io.open()`` over the built-in ``open()`` function is off by "
|
||||
"default in Modernize). Luckily, though, there are only a couple of things to "
|
||||
" watch out for which can be considered large issues that may be hard to "
|
||||
"debug if not watched for."
|
||||
"watch out for which can be considered large issues that may be hard to debug "
|
||||
"if not watched for."
|
||||
msgstr ""
|
||||
"Malheureusement les outils ne peuvent pas automatiser tous les changements "
|
||||
"requis pour permettre à votre code de s'exécuter sous Python 3 et il y a "
|
||||
|
@ -396,18 +396,18 @@ msgid ""
|
|||
"values result in a ``float``. This change has actually been planned since "
|
||||
"Python 2.2 which was released in 2002. Since then users have been encouraged "
|
||||
"to add ``from __future__ import division`` to any and all files which use "
|
||||
"the ``/`` and ``//`` operators or to be running the interpreter with the "
|
||||
"``-Q`` flag. If you have not been doing this then you will need to go "
|
||||
"through your code and do two things:"
|
||||
"the ``/`` and ``//`` operators or to be running the interpreter with the ``-"
|
||||
"Q`` flag. If you have not been doing this then you will need to go through "
|
||||
"your code and do two things:"
|
||||
msgstr ""
|
||||
"Dans Python 3, ``5 / 2 == 2.5`` et non ``2``; toutes les divisions entre des "
|
||||
"valeurs ``int`` renvoient un ``float``. Ce changement était en réalité "
|
||||
"planifié depuis Python 2.2, publié en 2002. Depuis cette date, les "
|
||||
"utilisateurs ont été encouragés à ajouter ``from __future__ import "
|
||||
"division`` à tous les fichiers utilisant les opérateurs ``/`` et ``//`` ou à "
|
||||
" exécuter l'interpréteur avec l'option ``-Q``. Si vous n'avez pas suivi "
|
||||
"cette recommandation, vous devrez manuellement modifier votre code et "
|
||||
"effectuer deux changements :"
|
||||
"exécuter l'interpréteur avec l'option ``-Q``. Si vous n'avez pas suivi cette "
|
||||
"recommandation, vous devrez manuellement modifier votre code et effectuer "
|
||||
"deux changements :"
|
||||
|
||||
#: ../Doc/howto/pyporting.rst:172
|
||||
msgid "Add ``from __future__ import division`` to your files"
|
||||
|
@ -426,9 +426,8 @@ msgstr ""
|
|||
msgid ""
|
||||
"The reason that ``/`` isn't simply translated to ``//`` automatically is "
|
||||
"that if an object defines a ``__truediv__`` method but not ``__floordiv__`` "
|
||||
"then your code would begin to fail (e.g. a user-defined class that uses "
|
||||
"``/`` to signify some operation but not ``//`` for the same thing or at "
|
||||
"all)."
|
||||
"then your code would begin to fail (e.g. a user-defined class that uses ``/"
|
||||
"`` to signify some operation but not ``//`` for the same thing or at all)."
|
||||
msgstr ""
|
||||
"La raison pour laquelle ``/`` n'est pas simplement remplacé par ``//`` "
|
||||
"automatiquement est que si un objet définit une méthode ``__truediv__`` mais "
|
||||
|
@ -455,11 +454,11 @@ msgstr ""
|
|||
"Dans Python 2, il était possible d'utiliser le type ``str`` pour du texte et "
|
||||
"pour des données binaires. Malheureusement cet amalgame entre deux concepts "
|
||||
"différents peut conduire à du code fragile pouvant parfois fonctionner pour "
|
||||
" les deux types de données et parfois non. Cela a également conduit à des "
|
||||
"API confuses si les auteurs ne déclaraient pas explicitement que quelque "
|
||||
"chose qui acceptait ``str`` était compatible avec du texte ou des données "
|
||||
"binaires et pas un seul des deux types. Cela a compliqué la situation pour "
|
||||
"les personnes devant gérer plusieurs langages avec des API qui ne se "
|
||||
"les deux types de données et parfois non. Cela a également conduit à des API "
|
||||
"confuses si les auteurs ne déclaraient pas explicitement que quelque chose "
|
||||
"qui acceptait ``str`` était compatible avec du texte ou des données binaires "
|
||||
"et pas un seul des deux types. Cela a compliqué la situation pour les "
|
||||
"personnes devant gérer plusieurs langages avec des API qui ne se "
|
||||
"préoccupaient pas de la gestion de ``unicode`` lorsqu'elles affirmaient être "
|
||||
"compatibles avec des données au format texte."
|
||||
|
||||
|
@ -499,8 +498,8 @@ msgid ""
|
|||
"Python 3). The following table lists the **unique** methods of each data "
|
||||
"type across Python 2 & 3 (e.g., the ``decode()`` method is usable on the "
|
||||
"equivalent binary data type in either Python 2 or 3, but it can't be used by "
|
||||
" the textual data type consistently between Python 2 and 3 because ``str`` "
|
||||
"in Python 3 doesn't have the method). Do note that as of Python 3.5 the "
|
||||
"the textual data type consistently between Python 2 and 3 because ``str`` in "
|
||||
"Python 3 doesn't have the method). Do note that as of Python 3.5 the "
|
||||
"``__mod__`` method was added to the bytes type."
|
||||
msgstr ""
|
||||
"Pour commencer, vous devrez choisir quelles API travaillent sur du texte et "
|
||||
|
@ -560,10 +559,9 @@ msgid ""
|
|||
"Making the distinction easier to handle can be accomplished by encoding and "
|
||||
"decoding between binary data and text at the edge of your code. This means "
|
||||
"that when you receive text in binary data, you should immediately decode it. "
|
||||
" And if your code needs to send text as binary data then encode it as late "
|
||||
"as possible. This allows your code to work with only text internally and "
|
||||
"thus eliminates having to keep track of what type of data you are working "
|
||||
"with."
|
||||
"And if your code needs to send text as binary data then encode it as late as "
|
||||
"possible. This allows your code to work with only text internally and thus "
|
||||
"eliminates having to keep track of what type of data you are working with."
|
||||
msgstr ""
|
||||
"Vous pouvez rendre le problème plus simple à gérer en réalisant les "
|
||||
"opérations d'encodage et de décodage entre données binaires et texte aux "
|
||||
|
@ -602,28 +600,28 @@ msgid ""
|
|||
"details. Therefore, you **must** make a decision of whether a file will be "
|
||||
"used for binary access (allowing binary data to be read and/or written) or "
|
||||
"textual access (allowing text data to be read and/or written). You should "
|
||||
"also use :func:`io.open` for opening files instead of the built-in "
|
||||
":func:`open` function as the :mod:`io` module is consistent from Python 2 to"
|
||||
" 3 while the built-in :func:`open` function is not (in Python 3 it's "
|
||||
"actually :func:`io.open`). Do not bother with the outdated practice of using"
|
||||
" :func:`codecs.open` as that's only necessary for keeping compatibility with"
|
||||
" Python 2.5."
|
||||
"also use :func:`io.open` for opening files instead of the built-in :func:"
|
||||
"`open` function as the :mod:`io` module is consistent from Python 2 to 3 "
|
||||
"while the built-in :func:`open` function is not (in Python 3 it's actually :"
|
||||
"func:`io.open`). Do not bother with the outdated practice of using :func:"
|
||||
"`codecs.open` as that's only necessary for keeping compatibility with Python "
|
||||
"2.5."
|
||||
msgstr ""
|
||||
"Une conséquence de cette dichotomie est que vous devez être prudents lors de "
|
||||
"l'ouverture d'un fichier. À moins que vous travailliez sous Windows, il y a "
|
||||
"des chances pour que vous ne vous soyez jamais préoccupé de spécifier le "
|
||||
"mode ``b`` lorsque vous ouvrez des fichiers binaires (par exemple ``rb`` "
|
||||
"pour lire un fichier binaire). Sous Python 3, les fichiers binaire et texte "
|
||||
"sont distincts et mutuellement incompatibles ; se référer au module "
|
||||
":mod:`io` pour plus de détails. Ainsi vous **devez** décider lorsque vous "
|
||||
"ouvrez un fichier si vous y accéderez en mode binaire (ce qui permet de lire"
|
||||
" et écrire des données binaires) ou en mode texte (ce qui permet de lire et "
|
||||
"sont distincts et mutuellement incompatibles ; se référer au module :mod:"
|
||||
"`io` pour plus de détails. Ainsi vous **devez** décider lorsque vous ouvrez "
|
||||
"un fichier si vous y accéderez en mode binaire (ce qui permet de lire et "
|
||||
"écrire des données binaires) ou en mode texte (ce qui permet de lire et "
|
||||
"écrire du texte). Vous devez également utiliser :func:`io.open` pour ouvrir "
|
||||
"des fichiers plutôt que la fonction native :func:`open` étant donné que le "
|
||||
"module :mod:`io` est cohérent de Python 2 à 3, ce qui n'est pas vrai pour la "
|
||||
" fonction :func:`open` (en Python 3, il s'agit en réalité de "
|
||||
":func:`io.open`). Ne cherchez pas à appliquer l'ancienne pratique consistant"
|
||||
" à utiliser :func:`codecs.open` qui n'est nécessaire que pour préserver une "
|
||||
"fonction :func:`open` (en Python 3, il s'agit en réalité de :func:`io."
|
||||
"open`). Ne cherchez pas à appliquer l'ancienne pratique consistant à "
|
||||
"utiliser :func:`codecs.open` qui n'est nécessaire que pour préserver une "
|
||||
"compatibilité avec Python 2.5."
|
||||
|
||||
#: ../Doc/howto/pyporting.rst:261
|
||||
|
@ -657,8 +655,8 @@ msgid ""
|
|||
"collection of binary numbers, Python 3 returns the integer value for the "
|
||||
"byte you index on. But in Python 2 because ``bytes == str``, indexing "
|
||||
"returns a one-item slice of bytes. The six_ project has a function named "
|
||||
"``six.indexbytes()`` which will return an integer like in Python 3: "
|
||||
"``six.indexbytes(b'123', 1)``."
|
||||
"``six.indexbytes()`` which will return an integer like in Python 3: ``six."
|
||||
"indexbytes(b'123', 1)``."
|
||||
msgstr ""
|
||||
"Enfin, l'indiçage des données binaires exige une manipulation prudente (bien "
|
||||
"que le découpage, ou *slicing* en anglais, ne nécessite pas d'attention "
|
||||
|
@ -762,8 +760,8 @@ msgid ""
|
|||
"than Python 2::"
|
||||
msgstr ""
|
||||
"Le problème est le suivant : que se passe-t-il lorsque Python 4 est publié ? "
|
||||
" Il serait préférable de traiter le cas Python 2 comme l'exception plutôt "
|
||||
"que Python 3 et de supposer que les versions futures de Python 2 seront plus"
|
||||
"Il serait préférable de traiter le cas Python 2 comme l'exception plutôt que "
|
||||
"Python 3 et de supposer que les versions futures de Python 2 seront plus "
|
||||
"compatibles avec Python 3 qu'avec Python 2 : ::"
|
||||
|
||||
#: ../Doc/howto/pyporting.rst:329
|
||||
|
@ -790,8 +788,8 @@ msgid ""
|
|||
msgstr ""
|
||||
"Une fois votre code traduit pour être compatible avec Python 3, vous devez "
|
||||
"vous assurer que votre code n'a pas régressé ou qu'il ne fonctionne pas sous "
|
||||
" Python 3. Ceci est particulièrement important si une de vos dépendances "
|
||||
"vous empêche de réellement exécuter le code sous Python 3 pour le moment."
|
||||
"Python 3. Ceci est particulièrement important si une de vos dépendances vous "
|
||||
"empêche de réellement exécuter le code sous Python 3 pour le moment."
|
||||
|
||||
#: ../Doc/howto/pyporting.rst:347
|
||||
msgid ""
|
||||
|
@ -842,15 +840,15 @@ msgid ""
|
|||
"to care about whether your dependencies have also been ported. The "
|
||||
"caniusepython3_ project was created to help you determine which projects -- "
|
||||
"directly or indirectly -- are blocking you from supporting Python 3. There "
|
||||
"is both a command-line tool as well as a web interface at "
|
||||
"https://caniusepython3.com."
|
||||
"is both a command-line tool as well as a web interface at https://"
|
||||
"caniusepython3.com."
|
||||
msgstr ""
|
||||
"**Après** avoir rendu votre code compatible avec Python 3, vous devez "
|
||||
"commencer à vous intéresser au portage de vos dépendances. Le projet "
|
||||
"caniusepython3_ a été créé afin de vous aider à déterminer quels projets "
|
||||
"sont bloquants dans votre support de Python 3, directement ou indirectement. "
|
||||
" Il existe un outil en ligne de commande ainsi qu'une interface web : "
|
||||
"https://caniusepython3.com."
|
||||
"Il existe un outil en ligne de commande ainsi qu'une interface web : https://"
|
||||
"caniusepython3.com."
|
||||
|
||||
#: ../Doc/howto/pyporting.rst:377
|
||||
msgid ""
|
||||
|
@ -922,10 +920,10 @@ msgstr ""
|
|||
"chaînes de caractères ou à un entier (cette deuxième possibilité est "
|
||||
"disponible à partir de Python 3.5). Par défaut, des comparaisons entre types "
|
||||
"différents renvoient simplement ``False`` mais si vous avez fait une erreur "
|
||||
" dans votre séparation de la gestion texte/données binaires ou votre "
|
||||
"indiçage des *bytes*, vous ne trouverez pas facilement le bogue. Ce drapeau "
|
||||
"lève une exception lorsque ce genre de comparaison apparaît, facilitant "
|
||||
"ainsi sa identification et sa localisation."
|
||||
"dans votre séparation de la gestion texte/données binaires ou votre indiçage "
|
||||
"des *bytes*, vous ne trouverez pas facilement le bogue. Ce drapeau lève une "
|
||||
"exception lorsque ce genre de comparaison apparaît, facilitant ainsi sa "
|
||||
"identification et sa localisation."
|
||||
|
||||
#: ../Doc/howto/pyporting.rst:410
|
||||
msgid ""
|
||||
|
@ -950,9 +948,9 @@ msgid ""
|
|||
"mypy_ or pytype_ on your code. These tools can be used to analyze your code "
|
||||
"as if it's being run under Python 2, then you can run the tool a second time "
|
||||
"as if your code is running under Python 3. By running a static type checker "
|
||||
" twice like this you can discover if you're e.g. misusing binary data type "
|
||||
"in one version of Python compared to another. If you add optional type hints"
|
||||
" to your code you can also explicitly state whether your APIs use textual or"
|
||||
"twice like this you can discover if you're e.g. misusing binary data type in "
|
||||
"one version of Python compared to another. If you add optional type hints to "
|
||||
"your code you can also explicitly state whether your APIs use textual or "
|
||||
"binary data, helping to make sure everything functions as expected in both "
|
||||
"versions of Python."
|
||||
msgstr ""
|
||||
|
|
Loading…
Reference in New Issue
Block a user