2016-10-30 09:46:26 +00:00
|
|
|
|
# SOME DESCRIPTIVE TITLE.
|
|
|
|
|
# Copyright (C) 1990-2016, Python Software Foundation
|
|
|
|
|
# This file is distributed under the same license as the Python package.
|
|
|
|
|
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
|
|
|
|
#
|
|
|
|
|
#, fuzzy
|
|
|
|
|
msgid ""
|
|
|
|
|
msgstr ""
|
|
|
|
|
"Project-Id-Version: Python 2.7\n"
|
|
|
|
|
"Report-Msgid-Bugs-To: \n"
|
|
|
|
|
"POT-Creation-Date: 2016-10-30 10:44+0100\n"
|
|
|
|
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
|
|
|
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
|
|
|
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
|
|
|
|
"MIME-Version: 1.0\n"
|
|
|
|
|
"Content-Type: text/plain; charset=UTF-8\n"
|
|
|
|
|
"Content-Transfer-Encoding: 8bit\n"
|
|
|
|
|
|
|
|
|
|
#: ../Doc/library/abc.rst:2
|
|
|
|
|
msgid ":mod:`abc` --- Abstract Base Classes"
|
|
|
|
|
msgstr ":mod:`abc` --- Classes de Base Abstraites"
|
|
|
|
|
|
|
|
|
|
#: ../Doc/library/abc.rst:12
|
|
|
|
|
msgid "**Source code:** :source:`Lib/abc.py`"
|
|
|
|
|
msgstr "**Code source:** :source:`Lib/abc.py`"
|
|
|
|
|
|
|
|
|
|
#: ../Doc/library/abc.rst:16
|
|
|
|
|
msgid ""
|
|
|
|
|
"This module provides the infrastructure for defining :term:`abstract base "
|
|
|
|
|
"classes <abstract base class>` (ABCs) in Python, as outlined in :pep:`3119`; "
|
|
|
|
|
"see the PEP for why this was added to Python. (See also :pep:`3141` and the :"
|
|
|
|
|
"mod:`numbers` module regarding a type hierarchy for numbers based on ABCs.)"
|
|
|
|
|
msgstr ""
|
2018-10-10 16:34:12 +00:00
|
|
|
|
"Le module fournit l'infrastructure pour définir les :term:`classes de bases "
|
|
|
|
|
"abstraites <abstract base class>` (*Abstract Base Class* ou *ABC* en "
|
|
|
|
|
"anglais) en Python, tel qu'indiqué dans la :pep:`3119`; voir la PEP pour la "
|
|
|
|
|
"raison de son ajout à Python. (Voir également la :pep:`3141` et le module :"
|
|
|
|
|
"mod:`numbers` pour ce qui concerne la hiérarchie de types pour les nombres "
|
|
|
|
|
"basés sur les classes de base abstraites). Par la suite nous utiliserons "
|
|
|
|
|
"l'abréviation ABC (*Abstract Base Class*) pour désigner une classe de base "
|
|
|
|
|
"abstraite."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
|
|
|
|
#: ../Doc/library/abc.rst:21
|
|
|
|
|
msgid ""
|
|
|
|
|
"The :mod:`collections` module has some concrete classes that derive from "
|
|
|
|
|
"ABCs; these can, of course, be further derived. In addition the :mod:"
|
|
|
|
|
"`collections` module has some ABCs that can be used to test whether a class "
|
|
|
|
|
"or instance provides a particular interface, for example, is it hashable or "
|
|
|
|
|
"a mapping."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/library/abc.rst:28
|
|
|
|
|
msgid "This module provides the following class:"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/library/abc.rst:32
|
|
|
|
|
msgid "Metaclass for defining Abstract Base Classes (ABCs)."
|
2018-10-10 16:34:12 +00:00
|
|
|
|
msgstr "Métaclasse pour définir des classes de base abstraites (ABC)."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
|
|
|
|
#: ../Doc/library/abc.rst:34
|
|
|
|
|
msgid ""
|
|
|
|
|
"Use this metaclass to create an ABC. An ABC can be subclassed directly, and "
|
|
|
|
|
"then acts as a mix-in class. You can also register unrelated concrete "
|
|
|
|
|
"classes (even built-in classes) and unrelated ABCs as \"virtual subclasses\" "
|
|
|
|
|
"-- these and their descendants will be considered subclasses of the "
|
|
|
|
|
"registering ABC by the built-in :func:`issubclass` function, but the "
|
|
|
|
|
"registering ABC won't show up in their MRO (Method Resolution Order) nor "
|
|
|
|
|
"will method implementations defined by the registering ABC be callable (not "
|
|
|
|
|
"even via :func:`super`). [#]_"
|
|
|
|
|
msgstr ""
|
2018-10-10 16:34:12 +00:00
|
|
|
|
"Utilisez cette métaclasse pour créer une ABC. Il est possible d'hériter "
|
|
|
|
|
"d'une ABC directement, cette classe de base abstraite fonctionne alors comme "
|
|
|
|
|
"une classe *mixin*. Vous pouvez également enregistrer une classe concrète "
|
|
|
|
|
"sans lien (même une classe native) et des ABC comme \"sous-classes virtuelles"
|
|
|
|
|
"\" -- celles-ci et leur descendantes seront considérées comme des sous-"
|
|
|
|
|
"classes de la classe de base abstraite par la fonction native :func:"
|
|
|
|
|
"`issubclass`, mais les ABC enregistrées n'apparaitront pas dans leur ordre "
|
|
|
|
|
"de résolution des méthodes (*MRO* pour *Method Resolution Order* en "
|
|
|
|
|
"anglais). Les implémentations de méthodes définies par l'ABC ne seront pas "
|
|
|
|
|
"appelable (pas même via :func:`super`). [#]_"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
|
|
|
|
#: ../Doc/library/abc.rst:43
|
|
|
|
|
msgid ""
|
|
|
|
|
"Classes created with a metaclass of :class:`ABCMeta` have the following "
|
|
|
|
|
"method:"
|
|
|
|
|
msgstr ""
|
2018-10-10 16:34:12 +00:00
|
|
|
|
"Les classes dont la métaclasse est :class:`ABCMeta` possèdent les méthodes "
|
|
|
|
|
"suivantes :"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
|
|
|
|
#: ../Doc/library/abc.rst:47
|
|
|
|
|
msgid ""
|
|
|
|
|
"Register *subclass* as a \"virtual subclass\" of this ABC. For example::"
|
|
|
|
|
msgstr ""
|
2018-10-10 16:34:12 +00:00
|
|
|
|
"Enregistrer *subclass* en tant que sous-classe virtuelle de cette ABC. Par "
|
|
|
|
|
"exemple : ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
|
|
|
|
#: ../Doc/library/abc.rst:60
|
|
|
|
|
msgid "You can also override this method in an abstract base class:"
|
2018-10-10 16:34:12 +00:00
|
|
|
|
msgstr "Vous pouvez également redéfinir cette méthode dans une ABC :"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
|
|
|
|
#: ../Doc/library/abc.rst:64
|
|
|
|
|
msgid "(Must be defined as a class method.)"
|
2018-10-10 16:34:12 +00:00
|
|
|
|
msgstr "(Doit être définie en tant que méthode de classe.)"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
|
|
|
|
#: ../Doc/library/abc.rst:66
|
|
|
|
|
msgid ""
|
|
|
|
|
"Check whether *subclass* is considered a subclass of this ABC. This means "
|
|
|
|
|
"that you can customize the behavior of ``issubclass`` further without the "
|
|
|
|
|
"need to call :meth:`register` on every class you want to consider a subclass "
|
|
|
|
|
"of the ABC. (This class method is called from the :meth:`__subclasscheck__` "
|
|
|
|
|
"method of the ABC.)"
|
|
|
|
|
msgstr ""
|
2018-10-10 16:34:12 +00:00
|
|
|
|
"Vérifie si *subclass* est considérée comme une sous-classe de cette ABC. "
|
|
|
|
|
"Cela signifie que vous pouvez personnaliser le comportement de "
|
|
|
|
|
"``issubclass`` sans nécessiter d'appeler :meth:`register` pour chacune des "
|
|
|
|
|
"classes que vous souhaitez considérer comme sous-classe de l'ABC. (Cette "
|
|
|
|
|
"méthode de classe est appelée par la méthode :meth:`__subclasscheck__` de la "
|
|
|
|
|
"classe de base abstraite)."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
|
|
|
|
#: ../Doc/library/abc.rst:72
|
|
|
|
|
msgid ""
|
|
|
|
|
"This method should return ``True``, ``False`` or ``NotImplemented``. If it "
|
|
|
|
|
"returns ``True``, the *subclass* is considered a subclass of this ABC. If it "
|
|
|
|
|
"returns ``False``, the *subclass* is not considered a subclass of this ABC, "
|
|
|
|
|
"even if it would normally be one. If it returns ``NotImplemented``, the "
|
|
|
|
|
"subclass check is continued with the usual mechanism."
|
|
|
|
|
msgstr ""
|
2018-10-10 16:34:12 +00:00
|
|
|
|
"Cette méthode doit renvoyer ``True``, ``False`` ou ``NotImplemented``. Si "
|
|
|
|
|
"elle renvoie ``True``, *subclass* est considérée comme sous-classe de cette "
|
|
|
|
|
"ABC. Si elle renvoie ``False``, la *subclass* n'est pas considérée une sous-"
|
|
|
|
|
"classe de cette ABC même si elle l'aurait été en temps normal. Si elle "
|
|
|
|
|
"renvoie ``NotImplemented``, la vérification d'appartenance à la sous-classe "
|
|
|
|
|
"continue via le mécanisme habituel."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
|
|
|
|
#: ../Doc/library/abc.rst:82
|
|
|
|
|
msgid ""
|
|
|
|
|
"For a demonstration of these concepts, look at this example ABC definition::"
|
|
|
|
|
msgstr ""
|
2018-10-10 16:34:12 +00:00
|
|
|
|
"Pour une illustration de ces concepts, voir cet exemple de définition de "
|
|
|
|
|
"ABC : ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
|
|
|
|
#: ../Doc/library/abc.rst:112
|
|
|
|
|
msgid ""
|
|
|
|
|
"The ABC ``MyIterable`` defines the standard iterable method, :meth:"
|
|
|
|
|
"`~iterator.__iter__`, as an abstract method. The implementation given here "
|
|
|
|
|
"can still be called from subclasses. The :meth:`get_iterator` method is "
|
|
|
|
|
"also part of the ``MyIterable`` abstract base class, but it does not have to "
|
|
|
|
|
"be overridden in non-abstract derived classes."
|
|
|
|
|
msgstr ""
|
2018-10-10 16:34:12 +00:00
|
|
|
|
"L'ABC ``MyIterable`` définit la méthode d'itération :meth:`~iterator."
|
|
|
|
|
"__iter__` comme méthode abstraite. L'implémentation qui lui est donnée ici "
|
|
|
|
|
"peut être appelée depuis les sous-classes. La méthode :meth:`get_iterator` "
|
|
|
|
|
"fait également partie de la classe de base abstraite ``MyIterable``, mais "
|
|
|
|
|
"elle n'a pas à être redéfinie dans les classes dérivées non-abstraites."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
|
|
|
|
#: ../Doc/library/abc.rst:118
|
|
|
|
|
msgid ""
|
|
|
|
|
"The :meth:`__subclasshook__` class method defined here says that any class "
|
|
|
|
|
"that has an :meth:`~iterator.__iter__` method in its :attr:`~object."
|
|
|
|
|
"__dict__` (or in that of one of its base classes, accessed via the :attr:"
|
|
|
|
|
"`~class.__mro__` list) is considered a ``MyIterable`` too."
|
|
|
|
|
msgstr ""
|
2018-10-10 16:34:12 +00:00
|
|
|
|
"La méthode de classe :meth:`__subclasshook__` définie ici dit que toute "
|
|
|
|
|
"classe qui possède la méthode :meth:`~iterator.__iter__` dans son :attr:"
|
|
|
|
|
"`~object.__dict__` (ou dans une de ses classes de base, accédée via la "
|
|
|
|
|
"liste :attr:`~class.__mro__`) est considérée également comme un "
|
|
|
|
|
"``MyIterable``."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
|
|
|
|
#: ../Doc/library/abc.rst:123
|
|
|
|
|
msgid ""
|
|
|
|
|
"Finally, the last line makes ``Foo`` a virtual subclass of ``MyIterable``, "
|
|
|
|
|
"even though it does not define an :meth:`~iterator.__iter__` method (it uses "
|
|
|
|
|
"the old-style iterable protocol, defined in terms of :meth:`__len__` and :"
|
|
|
|
|
"meth:`__getitem__`). Note that this will not make ``get_iterator`` "
|
|
|
|
|
"available as a method of ``Foo``, so it is provided separately."
|
|
|
|
|
msgstr ""
|
2018-10-10 16:34:12 +00:00
|
|
|
|
"Enfin, la dernière ligne fait de ``Foo`` une sous-classe virtuelle de "
|
|
|
|
|
"``MyIterable``, même si cette classe ne définit pas de méthode :meth:"
|
|
|
|
|
"`~iterator.__iter__` (elle utilise l'ancien protocole d'itération qui se "
|
|
|
|
|
"définit en termes de :meth:`__len__` et :meth:`__getitem__`). A noter que "
|
|
|
|
|
"cela ne rendra pas le ``get_iterator`` de ``MyIterable`` disponible comme "
|
|
|
|
|
"une méthode de ``Foo``, ``get_iterator`` est donc implémenté séparément."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
|
|
|
|
#: ../Doc/library/abc.rst:130
|
|
|
|
|
msgid "It also provides the following decorators:"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/library/abc.rst:134
|
|
|
|
|
msgid "A decorator indicating abstract methods."
|
2018-10-10 16:34:12 +00:00
|
|
|
|
msgstr "Un décorateur marquant les méthodes comme abstraites."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
|
|
|
|
#: ../Doc/library/abc.rst:136
|
|
|
|
|
msgid ""
|
|
|
|
|
"Using this decorator requires that the class's metaclass is :class:`ABCMeta` "
|
|
|
|
|
"or is derived from it. A class that has a metaclass derived from :class:"
|
|
|
|
|
"`ABCMeta` cannot be instantiated unless all of its abstract methods and "
|
|
|
|
|
"properties are overridden. The abstract methods can be called using any of "
|
|
|
|
|
"the normal 'super' call mechanisms."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/library/abc.rst:144
|
|
|
|
|
msgid ""
|
|
|
|
|
"Dynamically adding abstract methods to a class, or attempting to modify the "
|
|
|
|
|
"abstraction status of a method or class once it is created, are not "
|
|
|
|
|
"supported. The :func:`abstractmethod` only affects subclasses derived using "
|
|
|
|
|
"regular inheritance; \"virtual subclasses\" registered with the ABC's :meth:"
|
|
|
|
|
"`register` method are not affected."
|
|
|
|
|
msgstr ""
|
2018-10-10 16:34:12 +00:00
|
|
|
|
"Python ne gère pas l'ajout dynamique de méthodes abstraites à une classe, il "
|
|
|
|
|
"n'est pas non plus possible de modifier l'état d'abstraction d'une méthode "
|
|
|
|
|
"ou d'une classe une fois celle-ci créée. :func:`abstractmethod` n'affecte "
|
|
|
|
|
"que les sous-classes dérivées utilisant l'héritage classique. Les \"sous-"
|
|
|
|
|
"classes virtuelles\" enregistrées avec la méthode :meth:`register` de l'ABC "
|
|
|
|
|
"ne sont pas affectées."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
|
|
|
|
#: ../Doc/library/abc.rst:150 ../Doc/library/abc.rst:179
|
|
|
|
|
msgid "Usage::"
|
2018-10-10 16:34:12 +00:00
|
|
|
|
msgstr "Utilisation ::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
|
|
|
|
#: ../Doc/library/abc.rst:160
|
|
|
|
|
msgid ""
|
|
|
|
|
"Unlike Java abstract methods, these abstract methods may have an "
|
|
|
|
|
"implementation. This implementation can be called via the :func:`super` "
|
|
|
|
|
"mechanism from the class that overrides it. This could be useful as an end-"
|
|
|
|
|
"point for a super-call in a framework that uses cooperative multiple-"
|
|
|
|
|
"inheritance."
|
|
|
|
|
msgstr ""
|
2018-10-10 16:34:12 +00:00
|
|
|
|
"Contrairement aux méthodes abstraites Java, ces méthodes abstraites peuvent "
|
|
|
|
|
"être implémentées. Cette implémentation peut être appelée via le mécanisme :"
|
|
|
|
|
"func:`super` depuis la classe qui la redéfinit. C'est typiquement utile pour "
|
|
|
|
|
"y appeler *super* et ainsi coopérer correctement dans un environnement "
|
|
|
|
|
"utilisant de l'héritage multiple."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
|
|
|
|
#: ../Doc/library/abc.rst:170
|
|
|
|
|
msgid ""
|
|
|
|
|
"A subclass of the built-in :func:`property`, indicating an abstract property."
|
2018-10-10 16:34:12 +00:00
|
|
|
|
msgstr "Sous-classe de :func:`property`, qui indique une propriété abstraite."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
|
|
|
|
#: ../Doc/library/abc.rst:172
|
|
|
|
|
msgid ""
|
|
|
|
|
"Using this function requires that the class's metaclass is :class:`ABCMeta` "
|
|
|
|
|
"or is derived from it. A class that has a metaclass derived from :class:"
|
|
|
|
|
"`ABCMeta` cannot be instantiated unless all of its abstract methods and "
|
|
|
|
|
"properties are overridden. The abstract properties can be called using any "
|
|
|
|
|
"of the normal 'super' call mechanisms."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/library/abc.rst:187
|
|
|
|
|
msgid ""
|
|
|
|
|
"This defines a read-only property; you can also define a read-write abstract "
|
|
|
|
|
"property using the 'long' form of property declaration::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/library/abc.rst:198
|
|
|
|
|
msgid "Footnotes"
|
|
|
|
|
msgstr "Notes"
|
|
|
|
|
|
|
|
|
|
#: ../Doc/library/abc.rst:199
|
|
|
|
|
msgid ""
|
|
|
|
|
"C++ programmers should note that Python's virtual base class concept is not "
|
|
|
|
|
"the same as C++'s."
|
|
|
|
|
msgstr ""
|
2018-10-10 16:34:12 +00:00
|
|
|
|
"Les développeurs C++ noteront que le concept Python de classe de base "
|
|
|
|
|
"virtuelle ( *virtual base class* ) n'est pas le même que celui de C++."
|