forked from AFPy/python-docs-fr
Make merge (#1639)
Automerge of PR #1639 by @JulienPalard #1636 Closes #1636
This commit is contained in:
parent 7ea05b84b9
commit dafa30ed3c
58 changed files with 6267 additions and 46504 deletions
| | @ -5,7 +5,7 @@ msgid "" | |||
msgstr "" | ||||
"Project-Id-Version: Python 3\n" | ||||
"Report-Msgid-Bugs-To: \n" | ||||
"POT-Creation-Date: 2021-03-19 16:59+0100\n" | ||||
"POT-Creation-Date: 2021-05-19 22:36+0200\n" | ||||
"PO-Revision-Date: 2020-12-17 21:41+0100\n" | ||||
"Last-Translator: Mathieu Dupuy <deronnax@gmail.com>\n" | ||||
"Language-Team: FRENCH <traductions@lists.afpy.org>\n" | ||||
| | @ -224,20 +224,20 @@ msgid "The new class now logs access to both *name* and *age*:" | |||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:284 | ||||
msgid "The two *Person* instances contain only the private names::" | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:293 | ||||
msgid "Closing thoughts" | ||||
msgid "The two *Person* instances contain only the private names:" | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:295 | ||||
msgid "Closing thoughts" | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:297 | ||||
msgid "" | ||||
"A :term:`descriptor` is what we call any object that defines :meth:" | ||||
"`__get__`, :meth:`__set__`, or :meth:`__delete__`." | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:298 | ||||
#: howto/descriptor.rst:300 | ||||
msgid "" | ||||
"Optionally, descriptors can have a :meth:`__set_name__` method. This is " | ||||
"only used in cases where a descriptor needs to know either the class where " | ||||
| | @ -245,33 +245,33 @@ msgid "" | |||
"method, if present, is called even if the class is not a descriptor.)" | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:303 | ||||
#: howto/descriptor.rst:305 | ||||
msgid "" | ||||
"Descriptors get invoked by the dot \"operator\" during attribute lookup. If " | ||||
"a descriptor is accessed indirectly with ``vars(some_class)" | ||||
"[descriptor_name]``, the descriptor instance is returned without invoking it." | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:307 | ||||
#: howto/descriptor.rst:309 | ||||
msgid "" | ||||
"Descriptors only work when used as class variables. When put in instances, " | ||||
"they have no effect." | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:310 | ||||
#: howto/descriptor.rst:312 | ||||
msgid "" | ||||
"The main motivation for descriptors is to provide a hook allowing objects " | ||||
"stored in class variables to control what happens during attribute lookup." | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:313 | ||||
#: howto/descriptor.rst:315 | ||||
msgid "" | ||||
"Traditionally, the calling class controls what happens during lookup. " | ||||
"Descriptors invert that relationship and allow the data being looked-up to " | ||||
"have a say in the matter." | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:317 | ||||
#: howto/descriptor.rst:319 | ||||
msgid "" | ||||
"Descriptors are used throughout the language. It is how functions turn into " | ||||
"bound methods. Common tools like :func:`classmethod`, :func:" | ||||
| | @ -279,21 +279,21 @@ msgid "" | |||
"all implemented as descriptors." | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:324 | ||||
#: howto/descriptor.rst:326 | ||||
msgid "Complete Practical Example" | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:326 | ||||
#: howto/descriptor.rst:328 | ||||
msgid "" | ||||
"In this example, we create a practical and powerful tool for locating " | ||||
"notoriously hard to find data corruption bugs." | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:331 | ||||
#: howto/descriptor.rst:333 | ||||
msgid "Validator class" | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:333 | ||||
#: howto/descriptor.rst:335 | ||||
msgid "" | ||||
"A validator is a descriptor for managed attribute access. Prior to storing " | ||||
"any data, it verifies that the new value meets various type and range " | ||||
| | @ -301,39 +301,39 @@ msgid "" | |||
"prevent data corruption at its source." | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:338 | ||||
#: howto/descriptor.rst:340 | ||||
msgid "" | ||||
"This :class:`Validator` class is both an :term:`abstract base class` and a " | ||||
"managed attribute descriptor:" | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:361 | ||||
#: howto/descriptor.rst:363 | ||||
msgid "" | ||||
"Custom validators need to inherit from :class:`Validator` and must supply a :" | ||||
"meth:`validate` method to test various restrictions as needed." | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:366 | ||||
#: howto/descriptor.rst:368 | ||||
msgid "Custom validators" | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:368 | ||||
#: howto/descriptor.rst:370 | ||||
msgid "Here are three practical data validation utilities:" | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:370 | ||||
#: howto/descriptor.rst:372 | ||||
msgid "" | ||||
":class:`OneOf` verifies that a value is one of a restricted set of options." | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:372 | ||||
#: howto/descriptor.rst:374 | ||||
msgid "" | ||||
":class:`Number` verifies that a value is either an :class:`int` or :class:" | ||||
"`float`. Optionally, it verifies that a value is between a given minimum or " | ||||
"maximum." | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:376 | ||||
#: howto/descriptor.rst:378 | ||||
msgid "" | ||||
":class:`String` verifies that a value is a :class:`str`. Optionally, it " | ||||
"validates a given minimum or maximum length. It can validate a user-defined " | ||||
| | @ -341,39 +341,39 @@ msgid "" | |||
"as well." | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:435 | ||||
#: howto/descriptor.rst:437 | ||||
msgid "Practical application" | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:437 | ||||
#: howto/descriptor.rst:439 | ||||
msgid "Here's how the data validators can be used in a real class:" | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:452 | ||||
#: howto/descriptor.rst:454 | ||||
msgid "The descriptors prevent invalid instances from being created:" | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:479 | ||||
#: howto/descriptor.rst:481 | ||||
msgid "Technical Tutorial" | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:481 | ||||
#: howto/descriptor.rst:483 | ||||
msgid "" | ||||
"What follows is a more technical tutorial for the mechanics and details of " | ||||
"how descriptors work." | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:486 | ||||
#: howto/descriptor.rst:488 | ||||
msgid "Abstract" | ||||
msgstr "Résumé" | ||||
| ||||
#: howto/descriptor.rst:488 | ||||
#: howto/descriptor.rst:490 | ||||
msgid "" | ||||
"Defines descriptors, summarizes the protocol, and shows how descriptors are " | ||||
"called. Provides an example showing how object relational mappings work." | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:491 | ||||
#: howto/descriptor.rst:493 | ||||
#, fuzzy | ||||
msgid "" | ||||
"Learning about descriptors not only provides access to a larger toolset, it " | ||||
| | @ -383,12 +383,12 @@ msgstr "" | |||
"ensemble d'outils plus vaste, mais aussi de mieux comprendre le " | ||||
"fonctionnement de Python et d'apprécier l'élégance de sa conception." | ||||
| ||||
#: howto/descriptor.rst:496 | ||||
#: howto/descriptor.rst:498 | ||||
#, fuzzy | ||||
msgid "Definition and introduction" | ||||
msgstr "Définition et introduction" | ||||
| ||||
#: howto/descriptor.rst:498 | ||||
#: howto/descriptor.rst:500 | ||||
#, fuzzy | ||||
msgid "" | ||||
"In general, a descriptor is an attribute value that has one of the methods " | ||||
| | @ -402,7 +402,7 @@ msgstr "" | |||
"meth:`__set__`, et :meth:`__delete__`. Si l'une de ces méthodes est définie " | ||||
"pour un objet, il s'agit d'un descripteur." | ||||
| ||||
#: howto/descriptor.rst:503 | ||||
#: howto/descriptor.rst:505 | ||||
#, fuzzy | ||||
msgid "" | ||||
"The default behavior for attribute access is to get, set, or delete the " | ||||
| | @ -424,7 +424,7 @@ msgstr "" | |||
"Descriptor. Lorsque cela se produit dans la chaîne de précédence dépend de " | ||||
"quelles méthodes descripteur ont été définies." | ||||
| ||||
#: howto/descriptor.rst:512 | ||||
#: howto/descriptor.rst:514 | ||||
#, fuzzy | ||||
msgid "" | ||||
"Descriptors are a powerful, general purpose protocol. They are the " | ||||
| | @ -441,24 +441,24 @@ msgstr "" | |||
"un ensemble flexible de nouveaux outils pour les programmes Python " | ||||
"quotidiens." | ||||
| ||||
#: howto/descriptor.rst:520 | ||||
#: howto/descriptor.rst:522 | ||||
#, fuzzy | ||||
msgid "Descriptor protocol" | ||||
msgstr "Protocole descripteur" | ||||
| ||||
#: howto/descriptor.rst:522 | ||||
#: howto/descriptor.rst:524 | ||||
msgid "``descr.__get__(self, obj, type=None) -> value``" | ||||
msgstr "``descr.__get__(self, obj, type=None) -> value``" | ||||
| ||||
#: howto/descriptor.rst:524 | ||||
#: howto/descriptor.rst:526 | ||||
msgid "``descr.__set__(self, obj, value) -> None``" | ||||
msgstr "``descr.__set__(self, obj, value) -> None``" | ||||
| ||||
#: howto/descriptor.rst:526 | ||||
#: howto/descriptor.rst:528 | ||||
msgid "``descr.__delete__(self, obj) -> None``" | ||||
msgstr "``descr.__delete__(self, obj) -> None``" | ||||
| ||||
#: howto/descriptor.rst:528 | ||||
#: howto/descriptor.rst:530 | ||||
msgid "" | ||||
"That is all there is to it. Define any of these methods and an object is " | ||||
"considered a descriptor and can override default behavior upon being looked " | ||||
| | @ -468,7 +468,7 @@ msgstr "" | |||
"méthodes et un objet est considéré comme un descripteur et peut remplacer le " | ||||
"comportement par défaut lorsqu'il est recherché comme un attribut." | ||||
| ||||
#: howto/descriptor.rst:532 | ||||
#: howto/descriptor.rst:534 | ||||
#, fuzzy | ||||
msgid "" | ||||
"If an object defines :meth:`__set__` or :meth:`__delete__`, it is considered " | ||||
| | @ -481,7 +481,7 @@ msgstr "" | |||
"meth:`__get__` sont appelés descripteurs *non-data* (ils sont généralement " | ||||
"utilisés pour des méthodes mais d'autres utilisations sont possibles)." | ||||
| ||||
#: howto/descriptor.rst:537 | ||||
#: howto/descriptor.rst:539 | ||||
msgid "" | ||||
"Data and non-data descriptors differ in how overrides are calculated with " | ||||
"respect to entries in an instance's dictionary. If an instance's dictionary " | ||||
| | @ -497,7 +497,7 @@ msgstr "" | |||
"entrée portant le même nom qu'un descripteur *non-data*, l'entrée du " | ||||
"dictionnaire a la priorité." | ||||
| ||||
#: howto/descriptor.rst:543 | ||||
#: howto/descriptor.rst:545 | ||||
msgid "" | ||||
"To make a read-only data descriptor, define both :meth:`__get__` and :meth:" | ||||
"`__set__` with the :meth:`__set__` raising an :exc:`AttributeError` when " | ||||
| | @ -510,11 +510,11 @@ msgstr "" | |||
"`__set__set__` avec une exception élevant le caractère générique est " | ||||
"suffisant pour en faire un descripteur de données." | ||||
| ||||
#: howto/descriptor.rst:550 | ||||
#: howto/descriptor.rst:552 | ||||
msgid "Overview of descriptor invocation" | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:552 | ||||
#: howto/descriptor.rst:554 | ||||
#, fuzzy | ||||
msgid "" | ||||
"A descriptor can be called directly with ``desc.__get__(obj)`` or ``desc." | ||||
| | @ -523,13 +523,13 @@ msgstr "" | |||
"Un descripteur peut être appelé directement par son nom de méthode. Par " | ||||
"exemple, ``d.__get__(obj)``." | ||||
| ||||
#: howto/descriptor.rst:555 | ||||
#: howto/descriptor.rst:557 | ||||
msgid "" | ||||
"But it is more common for a descriptor to be invoked automatically from " | ||||
"attribute access." | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:558 | ||||
#: howto/descriptor.rst:560 | ||||
msgid "" | ||||
"The expression ``obj.x`` looks up the attribute ``x`` in the chain of " | ||||
"namespaces for ``obj``. If the search finds a descriptor outside of the " | ||||
| | @ -537,7 +537,7 @@ msgid "" | |||
"the precedence rules listed below." | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:563 | ||||
#: howto/descriptor.rst:565 | ||||
#, fuzzy | ||||
msgid "" | ||||
"The details of invocation depend on whether ``obj`` is an object, class, or " | ||||
| | @ -546,11 +546,11 @@ msgstr "" | |||
"Les détails de l'invocation dépendent du fait que ``obj`` est un objet ou " | ||||
"une classe." | ||||
| ||||
#: howto/descriptor.rst:568 | ||||
#: howto/descriptor.rst:570 | ||||
msgid "Invocation from an instance" | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:570 | ||||
#: howto/descriptor.rst:572 | ||||
msgid "" | ||||
"Instance lookup scans through a chain of namespaces giving data descriptors " | ||||
"the highest priority, followed by instance variables, then non-data " | ||||
| | @ -558,44 +558,44 @@ msgid "" | |||
"provided." | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:575 | ||||
#: howto/descriptor.rst:577 | ||||
msgid "" | ||||
"If a descriptor is found for ``a.x``, then it is invoked with: ``desc." | ||||
"__get__(a, type(a))``." | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:578 | ||||
#: howto/descriptor.rst:580 | ||||
msgid "" | ||||
"The logic for a dotted lookup is in :meth:`object.__getattribute__`. Here " | ||||
"is a pure Python equivalent:" | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:698 | ||||
#: howto/descriptor.rst:700 | ||||
msgid "" | ||||
"Interestingly, attribute lookup doesn't call :meth:`object.__getattribute__` " | ||||
"directly. Instead, both the dot operator and the :func:`getattr` function " | ||||
"perform attribute lookup by way of a helper function:" | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:713 | ||||
#: howto/descriptor.rst:747 | ||||
msgid "" | ||||
"So if :meth:`__getattr__` exists, it is called whenever :meth:" | ||||
"`__getattribute__` raises :exc:`AttributeError` (either directly or in one " | ||||
"of the descriptor calls)." | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:716 | ||||
#: howto/descriptor.rst:750 | ||||
msgid "" | ||||
"Also, if a user calls :meth:`object.__getattribute__` directly, the :meth:" | ||||
"`__getattr__` hook is bypassed entirely." | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:721 | ||||
#: howto/descriptor.rst:755 | ||||
#, fuzzy | ||||
msgid "Invocation from a class" | ||||
msgstr "Appelé depuis un Classe" | ||||
| ||||
#: howto/descriptor.rst:723 | ||||
#: howto/descriptor.rst:757 | ||||
msgid "" | ||||
"The logic for a dotted lookup such as ``A.x`` is in :meth:`type." | ||||
"__getattribute__`. The steps are similar to those for :meth:`object." | ||||
| | @ -603,27 +603,27 @@ msgid "" | |||
"through the class's :term:`method resolution order`." | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:728 | ||||
#: howto/descriptor.rst:762 | ||||
msgid "If a descriptor is found, it is invoked with ``desc.__get__(None, A)``." | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:730 | ||||
#: howto/descriptor.rst:764 | ||||
msgid "" | ||||
"The full C implementation can be found in :c:func:`type_getattro()` and :c:" | ||||
"func:`_PyType_Lookup()` in :source:`Objects/typeobject.c`." | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:735 | ||||
#: howto/descriptor.rst:769 | ||||
msgid "Invocation from super" | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:737 | ||||
#: howto/descriptor.rst:771 | ||||
msgid "" | ||||
"The logic for super's dotted lookup is in the :meth:`__getattribute__` " | ||||
"method for object returned by :class:`super()`." | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:740 | ||||
#: howto/descriptor.rst:774 | ||||
#, fuzzy | ||||
msgid "" | ||||
"A dotted lookup such as ``super(A, obj).m`` searches ``obj.__class__." | ||||
| | @ -639,7 +639,7 @@ msgstr "" | |||
"inchangé. S'il n'est pas dans le dictionnaire, la recherche de ``m`` revient " | ||||
"à une recherche utilisant :meth:`object.__getattribute__`." | ||||
| ||||
#: howto/descriptor.rst:745 | ||||
#: howto/descriptor.rst:779 | ||||
#, fuzzy | ||||
msgid "" | ||||
"The full C implementation can be found in :c:func:`super_getattro()` in :" | ||||
| | @ -651,32 +651,32 @@ msgstr "" | |||
"source:`Objects/typeobject.c` et un équivalent Python pur peut être trouvé " | ||||
"dans `Guido's Tutorial`_." | ||||
| ||||
#: howto/descriptor.rst:752 | ||||
#: howto/descriptor.rst:786 | ||||
msgid "Summary of invocation logic" | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:754 | ||||
#: howto/descriptor.rst:788 | ||||
msgid "" | ||||
"The mechanism for descriptors is embedded in the :meth:`__getattribute__()` " | ||||
"methods for :class:`object`, :class:`type`, and :func:`super`." | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:757 | ||||
#: howto/descriptor.rst:791 | ||||
msgid "The important points to remember are:" | ||||
msgstr "Les points importants à retenir sont :" | ||||
| ||||
#: howto/descriptor.rst:759 | ||||
#: howto/descriptor.rst:793 | ||||
#, fuzzy | ||||
msgid "Descriptors are invoked by the :meth:`__getattribute__` method." | ||||
msgstr "les descripteurs sont appelés par la méthode :meth:`__getattribute__`" | ||||
| ||||
#: howto/descriptor.rst:761 | ||||
#: howto/descriptor.rst:795 | ||||
msgid "" | ||||
"Classes inherit this machinery from :class:`object`, :class:`type`, or :func:" | ||||
"`super`." | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:764 | ||||
#: howto/descriptor.rst:798 | ||||
#, fuzzy | ||||
msgid "" | ||||
"Overriding :meth:`__getattribute__` prevents automatic descriptor calls " | ||||
| | @ -685,7 +685,7 @@ msgstr "" | |||
"redéfinir :meth:`__getattribute____` empêche les appels automatiques de " | ||||
"descripteurs" | ||||
| ||||
#: howto/descriptor.rst:767 | ||||
#: howto/descriptor.rst:801 | ||||
#, fuzzy | ||||
msgid "" | ||||
":meth:`object.__getattribute__` and :meth:`type.__getattribute__` make " | ||||
| | @ -696,25 +696,25 @@ msgstr "" | |||
":meth:`objet.__getattribute__` et :meth:`type.__getattribute__` font " | ||||
"différents appels à :meth:`__get__`." | ||||
| ||||
#: howto/descriptor.rst:772 | ||||
#: howto/descriptor.rst:806 | ||||
#, fuzzy | ||||
msgid "Data descriptors always override instance dictionaries." | ||||
msgstr "" | ||||
"les descripteurs de données remplacent toujours les dictionnaires " | ||||
"d'instances." | ||||
| ||||
#: howto/descriptor.rst:774 | ||||
#: howto/descriptor.rst:808 | ||||
#, fuzzy | ||||
msgid "Non-data descriptors may be overridden by instance dictionaries." | ||||
msgstr "" | ||||
"les descripteurs *non-data* peuvent être remplacés par des dictionnaires " | ||||
"d'instance." | ||||
| ||||
#: howto/descriptor.rst:778 | ||||
#: howto/descriptor.rst:812 | ||||
msgid "Automatic name notification" | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:780 | ||||
#: howto/descriptor.rst:814 | ||||
msgid "" | ||||
"Sometimes it is desirable for a descriptor to know what class variable name " | ||||
"it was assigned to. When a new class is created, the :class:`type` " | ||||
| | @ -724,7 +724,7 @@ msgid "" | |||
"and the *name* is the class variable the descriptor was assigned to." | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:787 | ||||
#: howto/descriptor.rst:821 | ||||
#, fuzzy | ||||
msgid "" | ||||
"The implementation details are in :c:func:`type_new()` and :c:func:" | ||||
| | @ -734,53 +734,53 @@ msgstr "" | |||
"source:`Objects/typeobject.c` et un équivalent Python pur peut être trouvé " | ||||
"dans `Guido's Tutorial`_." | ||||
| ||||
#: howto/descriptor.rst:790 | ||||
#: howto/descriptor.rst:824 | ||||
msgid "" | ||||
"Since the update logic is in :meth:`type.__new__`, notifications only take " | ||||
"place at the time of class creation. If descriptors are added to the class " | ||||
"afterwards, :meth:`__set_name__` will need to be called manually." | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:796 | ||||
#: howto/descriptor.rst:830 | ||||
msgid "ORM example" | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:798 | ||||
#: howto/descriptor.rst:832 | ||||
msgid "" | ||||
"The following code is simplified skeleton showing how data descriptors could " | ||||
"be used to implement an `object relational mapping <https://en.wikipedia.org/" | ||||
"wiki/Object%E2%80%93relational_mapping>`_." | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:802 | ||||
#: howto/descriptor.rst:836 | ||||
msgid "" | ||||
"The essential idea is that the data is stored in an external database. The " | ||||
"Python instances only hold keys to the database's tables. Descriptors take " | ||||
"care of lookups or updates:" | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:821 | ||||
#: howto/descriptor.rst:855 | ||||
msgid "" | ||||
"We can use the :class:`Field` class to define `models <https://en.wikipedia." | ||||
"org/wiki/Database_model>`_ that describe the schema for each table in a " | ||||
"database:" | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:846 | ||||
#: howto/descriptor.rst:880 | ||||
msgid "To use the models, first connect to the database::" | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:851 | ||||
#: howto/descriptor.rst:885 | ||||
msgid "" | ||||
"An interactive session shows how data is retrieved from the database and how " | ||||
"it can be updated:" | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:896 | ||||
#: howto/descriptor.rst:930 | ||||
msgid "Pure Python Equivalents" | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:898 | ||||
#: howto/descriptor.rst:932 | ||||
#, fuzzy | ||||
msgid "" | ||||
"The descriptor protocol is simple and offers exciting possibilities. " | ||||
| | @ -794,11 +794,11 @@ msgstr "" | |||
"statiques et les méthodes de classe sont toutes basées sur le protocole du " | ||||
"descripteur." | ||||
| ||||
#: howto/descriptor.rst:905 | ||||
#: howto/descriptor.rst:939 | ||||
msgid "Properties" | ||||
msgstr "Propriétés" | ||||
| ||||
#: howto/descriptor.rst:907 | ||||
#: howto/descriptor.rst:941 | ||||
#, fuzzy | ||||
msgid "" | ||||
"Calling :func:`property` is a succinct way of building a data descriptor " | ||||
| | @ -809,7 +809,7 @@ msgstr "" | |||
"descripteur de données qui déclenche des appels de fonction lors de l'accès " | ||||
"à un attribut. Sa signature est ::" | ||||
| ||||
#: howto/descriptor.rst:912 | ||||
#: howto/descriptor.rst:946 | ||||
#, fuzzy | ||||
msgid "" | ||||
"The documentation shows a typical use to define a managed attribute ``x``:" | ||||
| | @ -817,7 +817,7 @@ msgstr "" | |||
"La documentation montre une utilisation typique pour définir un attribut " | ||||
"géré ``x`` ::" | ||||
| ||||
#: howto/descriptor.rst:922 | ||||
#: howto/descriptor.rst:970 | ||||
#, fuzzy | ||||
msgid "" | ||||
"To see how :func:`property` is implemented in terms of the descriptor " | ||||
| | @ -826,7 +826,7 @@ msgstr "" | |||
"Pour voir comment :func:`property` est implémenté dans le protocole du " | ||||
"descripteur, voici un un équivalent Python pur ::" | ||||
| ||||
#: howto/descriptor.rst:1015 | ||||
#: howto/descriptor.rst:1063 | ||||
msgid "" | ||||
"The :func:`property` builtin helps whenever a user interface has granted " | ||||
"attribute access and then subsequent changes require the intervention of a " | ||||
| | @ -836,7 +836,7 @@ msgstr "" | |||
"utilisateur a accordé l'accès à un attribut et que des modifications " | ||||
"ultérieures nécessitent l'intervention d'une méthode." | ||||
| ||||
#: howto/descriptor.rst:1019 | ||||
#: howto/descriptor.rst:1067 | ||||
#, fuzzy | ||||
msgid "" | ||||
"For instance, a spreadsheet class may grant access to a cell value through " | ||||
| | @ -853,18 +853,18 @@ msgstr "" | |||
"directement à l'attribut. La solution consiste à envelopper l'accès à " | ||||
"l'attribut de valeur dans un descripteur de données de propriété ::" | ||||
| ||||
#: howto/descriptor.rst:1036 | ||||
#: howto/descriptor.rst:1084 | ||||
msgid "" | ||||
"Either the built-in :func:`property` or our :func:`Property` equivalent " | ||||
"would work in this example." | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:1041 | ||||
#: howto/descriptor.rst:1089 | ||||
#, fuzzy | ||||
msgid "Functions and methods" | ||||
msgstr "Fonctions et méthodes" | ||||
| ||||
#: howto/descriptor.rst:1043 | ||||
#: howto/descriptor.rst:1091 | ||||
msgid "" | ||||
"Python's object oriented features are built upon a function based " | ||||
"environment. Using non-data descriptors, the two are merged seamlessly." | ||||
| | @ -873,7 +873,7 @@ msgstr "" | |||
"environnement basé sur des fonctions. À l'aide de descripteurs *non-data*, " | ||||
"les deux sont fusionnés de façon transparente." | ||||
| ||||
#: howto/descriptor.rst:1046 | ||||
#: howto/descriptor.rst:1094 | ||||
#, fuzzy | ||||
msgid "" | ||||
"Functions stored in class dictionaries get turned into methods when invoked. " | ||||
| | @ -889,13 +889,13 @@ msgstr "" | |||
"convention Python, la référence de l'instance est appelée *self* mais peut " | ||||
"être appelée *this* ou tout autre nom de variable." | ||||
| ||||
#: howto/descriptor.rst:1051 | ||||
#: howto/descriptor.rst:1099 | ||||
msgid "" | ||||
"Methods can be created manually with :class:`types.MethodType` which is " | ||||
"roughly equivalent to:" | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:1068 | ||||
#: howto/descriptor.rst:1116 | ||||
#, fuzzy | ||||
msgid "" | ||||
"To support automatic creation of methods, functions include the :meth:" | ||||
| | @ -909,7 +909,7 @@ msgstr "" | |||
"*non-data* qui renvoient des méthodes liées lorsqu'elles sont appelées " | ||||
"depuis un objet. En Python pur, il fonctionne comme ceci ::" | ||||
| ||||
#: howto/descriptor.rst:1084 | ||||
#: howto/descriptor.rst:1132 | ||||
#, fuzzy | ||||
msgid "" | ||||
"Running the following class in the interpreter shows how the function " | ||||
| | @ -918,47 +918,47 @@ msgstr "" | |||
"L'exécution de l'interpréteur montre comment le descripteur de fonction se " | ||||
"comporte dans la pratique ::" | ||||
| ||||
#: howto/descriptor.rst:1093 | ||||
#: howto/descriptor.rst:1141 | ||||
msgid "" | ||||
"The function has a :term:`qualified name` attribute to support introspection:" | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:1100 | ||||
#: howto/descriptor.rst:1148 | ||||
msgid "" | ||||
"Accessing the function through the class dictionary does not invoke :meth:" | ||||
"`__get__`. Instead, it just returns the underlying function object::" | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:1106 | ||||
#: howto/descriptor.rst:1154 | ||||
msgid "" | ||||
"Dotted access from a class calls :meth:`__get__` which just returns the " | ||||
"underlying function unchanged::" | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:1112 | ||||
#: howto/descriptor.rst:1160 | ||||
msgid "" | ||||
"The interesting behavior occurs during dotted access from an instance. The " | ||||
"dotted lookup calls :meth:`__get__` which returns a bound method object::" | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:1119 | ||||
#: howto/descriptor.rst:1167 | ||||
msgid "" | ||||
"Internally, the bound method stores the underlying function and the bound " | ||||
"instance::" | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:1128 | ||||
#: howto/descriptor.rst:1176 | ||||
msgid "" | ||||
"If you have ever wondered where *self* comes from in regular methods or " | ||||
"where *cls* comes from in class methods, this is it!" | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:1133 | ||||
#: howto/descriptor.rst:1181 | ||||
#, fuzzy | ||||
msgid "Other kinds of methods" | ||||
msgid "Kinds of methods" | ||||
msgstr "Fonctions et méthodes" | ||||
| ||||
#: howto/descriptor.rst:1135 | ||||
#: howto/descriptor.rst:1183 | ||||
msgid "" | ||||
"Non-data descriptors provide a simple mechanism for variations on the usual " | ||||
"patterns of binding functions into methods." | ||||
| | @ -966,7 +966,7 @@ msgstr "" | |||
"Les descripteurs *non-data* fournissent un mécanisme simple pour les " | ||||
"variations des patrons habituels des fonctions de liaison dans les méthodes." | ||||
| ||||
#: howto/descriptor.rst:1138 | ||||
#: howto/descriptor.rst:1186 | ||||
#, fuzzy | ||||
msgid "" | ||||
"To recap, functions have a :meth:`__get__` method so that they can be " | ||||
| | @ -979,60 +979,60 @@ msgstr "" | |||
"descripteur *non-data* transforme un appel ``obj.f(*args)``en ``f(obj, " | ||||
"*args)``. Appeler ``klass.f(*args)`` devient ``f(*args)``." | ||||
| ||||
#: howto/descriptor.rst:1143 | ||||
#: howto/descriptor.rst:1191 | ||||
msgid "This chart summarizes the binding and its two most useful variants:" | ||||
msgstr "" | ||||
"Ce tableau résume le lien (*binding*) et ses deux variantes les plus " | ||||
"utiles ::" | ||||
| ||||
#: howto/descriptor.rst:1146 | ||||
#: howto/descriptor.rst:1194 | ||||
msgid "Transformation" | ||||
msgstr "Transformation" | ||||
| ||||
#: howto/descriptor.rst:1146 | ||||
#: howto/descriptor.rst:1194 | ||||
#, fuzzy | ||||
msgid "Called from an object" | ||||
msgstr "Appelé depuis un Objet" | ||||
| ||||
#: howto/descriptor.rst:1146 | ||||
#: howto/descriptor.rst:1194 | ||||
#, fuzzy | ||||
msgid "Called from a class" | ||||
msgstr "Appelé depuis un Classe" | ||||
| ||||
#: howto/descriptor.rst:1149 | ||||
#: howto/descriptor.rst:1197 | ||||
msgid "function" | ||||
msgstr "fonction" | ||||
| ||||
#: howto/descriptor.rst:1149 | ||||
#: howto/descriptor.rst:1197 | ||||
msgid "f(obj, \\*args)" | ||||
msgstr "f(obj, \\*args)" | ||||
| ||||
#: howto/descriptor.rst:1151 | ||||
#: howto/descriptor.rst:1199 | ||||
msgid "f(\\*args)" | ||||
msgstr "f(\\*args)" | ||||
| ||||
#: howto/descriptor.rst:1151 | ||||
#: howto/descriptor.rst:1199 | ||||
msgid "staticmethod" | ||||
msgstr "méthode statique" | ||||
| ||||
#: howto/descriptor.rst:1153 | ||||
#: howto/descriptor.rst:1201 | ||||
msgid "classmethod" | ||||
msgstr "méthode de classe" | ||||
| ||||
#: howto/descriptor.rst:1153 | ||||
#: howto/descriptor.rst:1201 | ||||
msgid "f(type(obj), \\*args)" | ||||
msgstr "f(type(obj), \\*args)" | ||||
| ||||
#: howto/descriptor.rst:1153 | ||||
#: howto/descriptor.rst:1201 | ||||
msgid "f(cls, \\*args)" | ||||
msgstr "f(cls, \\*args)" | ||||
| ||||
#: howto/descriptor.rst:1158 | ||||
#: howto/descriptor.rst:1206 | ||||
#, fuzzy | ||||
msgid "Static methods" | ||||
msgstr "méthode statique" | ||||
| ||||
#: howto/descriptor.rst:1160 | ||||
#: howto/descriptor.rst:1208 | ||||
msgid "" | ||||
"Static methods return the underlying function without changes. Calling " | ||||
"either ``c.f`` or ``C.f`` is the equivalent of a direct lookup into ``object." | ||||
| | @ -1046,7 +1046,7 @@ msgstr "" | |||
"__getattribute__(C, \"f\")``. Par conséquent, la fonction devient accessible " | ||||
"de manière identique à partir d'un objet ou d'une classe." | ||||
| ||||
#: howto/descriptor.rst:1166 | ||||
#: howto/descriptor.rst:1214 | ||||
msgid "" | ||||
"Good candidates for static methods are methods that do not reference the " | ||||
"``self`` variable." | ||||
| | @ -1054,7 +1054,7 @@ msgstr "" | |||
"Les bonnes candidates pour être méthode statique sont des méthodes qui ne " | ||||
"font pas référence à la variable ``self``." | ||||
| ||||
#: howto/descriptor.rst:1169 | ||||
#: howto/descriptor.rst:1217 | ||||
msgid "" | ||||
"For instance, a statistics package may include a container class for " | ||||
"experimental data. The class provides normal methods for computing the " | ||||
| | @ -1076,7 +1076,7 @@ msgstr "" | |||
"appelée à partir d'un objet ou de la classe : ``s.erf(1.5) --> .9332``` ou " | ||||
"``Sample.erf(1.5) --> .9332``." | ||||
| ||||
#: howto/descriptor.rst:1178 | ||||
#: howto/descriptor.rst:1226 | ||||
#, fuzzy | ||||
msgid "" | ||||
"Since static methods return the underlying function with no changes, the " | ||||
| | @ -1085,7 +1085,7 @@ msgstr "" | |||
"Depuis que les méthodes statiques renvoient la fonction sous-jacente sans " | ||||
"changement, les exemples d’appels ne sont pas excitants ::" | ||||
| ||||
#: howto/descriptor.rst:1195 | ||||
#: howto/descriptor.rst:1243 | ||||
#, fuzzy | ||||
msgid "" | ||||
"Using the non-data descriptor protocol, a pure Python version of :func:" | ||||
| | @ -1094,12 +1094,12 @@ msgstr "" | |||
"En utilisant le protocole de descripteur *non-data*, une version Python pure " | ||||
"de :func:`staticmethod` ressemblerait à ceci ::" | ||||
| ||||
#: howto/descriptor.rst:1211 | ||||
#: howto/descriptor.rst:1275 | ||||
#, fuzzy | ||||
msgid "Class methods" | ||||
msgstr "méthode de classe" | ||||
| ||||
#: howto/descriptor.rst:1213 | ||||
#: howto/descriptor.rst:1277 | ||||
#, fuzzy | ||||
msgid "" | ||||
"Unlike static methods, class methods prepend the class reference to the " | ||||
| | @ -1110,7 +1110,7 @@ msgstr "" | |||
"référence de classe dans la liste d'arguments avant d'appeler la fonction. " | ||||
"Ce format est le même que l'appelant soit un objet ou une classe ::" | ||||
| ||||
#: howto/descriptor.rst:1231 | ||||
#: howto/descriptor.rst:1295 | ||||
#, fuzzy | ||||
msgid "" | ||||
"This behavior is useful whenever the method only needs to have a class " | ||||
| | @ -1126,14 +1126,14 @@ msgstr "" | |||
"nouveau dictionnaire à partir d'une liste de clés. L'équivalent Python pur " | ||||
"est ::" | ||||
| ||||
#: howto/descriptor.rst:1248 | ||||
#: howto/descriptor.rst:1312 | ||||
#, fuzzy | ||||
msgid "Now a new dictionary of unique keys can be constructed like this:" | ||||
msgstr "" | ||||
"Maintenant un nouveau dictionnaire de clés uniques peut être construit comme " | ||||
"ceci ::" | ||||
| ||||
#: howto/descriptor.rst:1258 | ||||
#: howto/descriptor.rst:1322 | ||||
#, fuzzy | ||||
msgid "" | ||||
"Using the non-data descriptor protocol, a pure Python version of :func:" | ||||
| | @ -1142,37 +1142,38 @@ msgstr "" | |||
"En utilisant le protocole de descripteur *non-data*, une version Python pure " | ||||
"de :func:`classmethod` ressemblerait à ceci ::" | ||||
| ||||
#: howto/descriptor.rst:1296 | ||||
#: howto/descriptor.rst:1371 | ||||
msgid "" | ||||
"The code path for ``hasattr(obj, '__get__')`` was added in Python 3.9 and " | ||||
"makes it possible for :func:`classmethod` to support chained decorators. For " | ||||
"example, a classmethod and property could be chained together:" | ||||
"The code path for ``hasattr(type(self.f), '__get__')`` was added in Python " | ||||
"3.9 and makes it possible for :func:`classmethod` to support chained " | ||||
"decorators. For example, a classmethod and property could be chained " | ||||
"together:" | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:1315 | ||||
#: howto/descriptor.rst:1391 | ||||
msgid "Member objects and __slots__" | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:1317 | ||||
#: howto/descriptor.rst:1393 | ||||
msgid "" | ||||
"When a class defines ``__slots__``, it replaces instance dictionaries with a " | ||||
"fixed-length array of slot values. From a user point of view that has " | ||||
"several effects:" | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:1321 | ||||
#: howto/descriptor.rst:1397 | ||||
msgid "" | ||||
"1. Provides immediate detection of bugs due to misspelled attribute " | ||||
"assignments. Only attribute names specified in ``__slots__`` are allowed:" | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:1337 | ||||
#: howto/descriptor.rst:1413 | ||||
msgid "" | ||||
"2. Helps create immutable objects where descriptors manage access to private " | ||||
"attributes stored in ``__slots__``:" | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:1372 | ||||
#: howto/descriptor.rst:1448 | ||||
msgid "" | ||||
"3. Saves memory. On a 64-bit Linux build, an instance with two attributes " | ||||
"takes 48 bytes with ``__slots__`` and 152 bytes without. This `flyweight " | ||||
| | @ -1180,13 +1181,13 @@ msgid "" | |||
"only matters when a large number of instances are going to be created." | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:1377 | ||||
#: howto/descriptor.rst:1453 | ||||
msgid "" | ||||
"4. Blocks tools like :func:`functools.cached_property` which require an " | ||||
"instance dictionary to function correctly:" | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:1399 | ||||
#: howto/descriptor.rst:1475 | ||||
msgid "" | ||||
"It is not possible to create an exact drop-in pure Python version of " | ||||
"``__slots__`` because it requires direct access to C structures and control " | ||||
| | @ -1196,37 +1197,37 @@ msgid "" | |||
"managed by member descriptors:" | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:1442 | ||||
#: howto/descriptor.rst:1518 | ||||
msgid "" | ||||
"The :meth:`type.__new__` method takes care of adding member objects to class " | ||||
"variables:" | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:1458 | ||||
#: howto/descriptor.rst:1534 | ||||
msgid "" | ||||
"The :meth:`object.__new__` method takes care of creating instances that have " | ||||
"slots instead of an instance dictionary. Here is a rough simulation in pure " | ||||
"Python:" | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:1493 | ||||
#: howto/descriptor.rst:1569 | ||||
msgid "" | ||||
"To use the simulation in a real class, just inherit from :class:`Object` and " | ||||
"set the :term:`metaclass` to :class:`Type`:" | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:1507 | ||||
#: howto/descriptor.rst:1583 | ||||
msgid "" | ||||
"At this point, the metaclass has loaded member objects for *x* and *y*::" | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:1528 | ||||
#: howto/descriptor.rst:1604 | ||||
msgid "" | ||||
"When instances are created, they have a ``slot_values`` list where the " | ||||
"attributes are stored:" | ||||
msgstr "" | ||||
| ||||
#: howto/descriptor.rst:1540 | ||||
#: howto/descriptor.rst:1616 | ||||
msgid "Misspelled or unassigned attributes will raise an exception:" | ||||
msgstr "" | ||||
| ||||
| | | |||
Loading…
Add table
Add a link
Reference in a new issue