# SOME DESCRIPTIVE TITLE. # Copyright (C) 1990-2020, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: msgid "" msgstr "" "Project-Id-Version: Python 2.7\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-02-09 18:46+0900\n" "PO-Revision-Date: 2019-11-11 14:16+0000\n" "Last-Translator: Lilian Corrêa \n" "Language-Team: Portuguese (Brazil) (http://www.transifex.com/python-doc/python-27/language/pt_BR/)\n" "Language: pt_BR\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" #: ../../library/abc.rst:2 msgid ":mod:`abc` --- Abstract Base Classes" msgstr ":mod:`abc` --- Classes Base Abstratas" #: ../../library/abc.rst:12 msgid "**Source code:** :source:`Lib/abc.py`" msgstr "**Código Fonte:** :source:`Lib/abc.py`" #: ../../library/abc.rst:16 msgid "" "This module provides the infrastructure for defining :term:`abstract base " "classes ` (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 "" "Este módulo fornece a infraestrutura para definir :term:`abstract base " "classes` (CBAs) em Python, como delineado em :pep:`3119`; veja o PEP para " "entender o porquê isto foi adicionado ao Python. (Veja também :pep:`3141` e " "o módulo :mod:`numbers` sobre uma hierarquia de tipos para números baseado " "nas CBAs.) " #: ../../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, if it is " "hashable or if it is a mapping." msgstr "" #: ../../library/abc.rst:28 msgid "This module provides the following class:" msgstr "" #: ../../library/abc.rst:32 msgid "Metaclass for defining Abstract Base Classes (ABCs)." msgstr "Metaclasse para definir Classe Base Abstrata (CBAs)." #: ../../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 "" "Use esta metaclasse para criar uma CBA. Uma CBA pode ser diretamente " "subclasseada, e então agir como uma classe misturada. Você também pode " "registrar classes concretas não relacionadas (até mesmo classes embutidas) e" " CBAs não relacionadas como \"subclasses virtuais\" -- estas e suas " "descendentes serão consideradas subclasses da CBA de registro pela função " "embutida :func:`issubclass`, mas a CBA de registro não irá aparecer na ORM " "(Ordem de Resolução do Método) e nem as implementações do método definidas " "pela CBA de registro será chamável (nem mesmo via :func:`super`). [#]_" #: ../../library/abc.rst:43 msgid "" "Classes created with a metaclass of :class:`ABCMeta` have the following " "method:" msgstr "" "Classes criadas com a metaclasse de :classe:`ABCMeta` tem o seguinte método:" " " #: ../../library/abc.rst:47 msgid "Register *subclass* as a \"virtual subclass\" of this ABC. For example::" msgstr "" "Registrar *subclasse* como uma \"subclasse virtual\" desta CBA. Por exemplo:" " " #: ../../library/abc.rst:60 msgid "You can also override this method in an abstract base class:" msgstr "Você também pode sobrepor este método em uma classe base abstrata: " #: ../../library/abc.rst:64 msgid "(Must be defined as a class method.)" msgstr "(Deve obrigatoriamente ser definido como um método de classe.)" #: ../../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 "" "Cheque se a *subclasse* é considerada uma subclasse desta CBA. Isto " "significa que você pode customizar ainda mais o comportamento da " "``issubclass`` sem a necessidade de chamar :meth:`register` em toda classe " "que você queira considerar uma subclasse da CBA. (Este método de classe é " "chamado do método da CBA :meth:`__subclasscheck__` .) " #: ../../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 "" "Este método deve retornar ``True``, ``False`` ou ``NotImplemented``. Se " "retornar ``True``, a *subclasse* é considerada uma subclasse desta CBA. Se " "retornar ``False``, a *subclasse* não é considerada uma subclasse desta CBA," " mesmo que normalmente seria uma. Se retornar ``NotImplemented``, a " "verificação da subclasse é continuada com o mecanismo usual. " #: ../../library/abc.rst:82 msgid "" "For a demonstration of these concepts, look at this example ABC definition::" msgstr "" "Para uma demonstração destes conceitos, veja este exemplo de definição CBA::" " " #: ../../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 "" "A CBA ``Mylterable`` define o método iterável padrão, " ":meth:`~iterator.__iter__`, como um método abstrato. A implementação dada " "aqui pode ainda ser chamada da subclasse. O método :meth:`get_iterator` é " "também parte da classe base abstrata ``MyIterable``, mas não precisa ser " "substituído nas classes derivadas não abstratas. " #: ../../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 "" "O método de classe :meth:`__subclasshook__` definido aqui diz que qualquer " "classe que tenha um método :meth:`~iterador.__iter__` em seu " ":attr:`~objeto.__dict__` (ou no de uma de suas classes base, acessados via " "lista :attr:`~classe.__mro__`) é considerado uma ``MyIterable`` também. " #: ../../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 "" "Finalmente, a última linha faz de ``Foo`` uma subclasse virtual da " "``MyIterable``, apesar de não definir um método :meth:`~iterador.__iter__` " "(ela usa o protocolo iterável antigo, definido em termos de :meth:`__len__` " "e :meth:`__getitem__`). Note que isto não fará o ``get_iterator`` disponível" " como um método de ``Foo``, então ele é fornecido separadamente." #: ../../library/abc.rst:130 msgid "It also provides the following decorators:" msgstr "" #: ../../library/abc.rst:134 msgid "A decorator indicating abstract methods." msgstr "Um decorator indicando métodos abstratos." #: ../../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 "" #: ../../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 "" "Adicionar dinamicamente métodos abstratos a uma classe, ou tentar modificar " "o status de abstração de um método ou classe uma vez que estejam criados, " "não é tolerado. A :func:`abstractmethod` afeta apenas subclasses derivadas " "usando herança regular; \"subclasses virtuais\" registradas com o método da " "CBA :meth:`register` não são afetadas. " #: ../../library/abc.rst:150 ../../library/abc.rst:179 msgid "Usage::" msgstr "Utilização::" #: ../../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 "" "Diferente de métodos abstratos Java, esses métodos abstratos podem ter uma " "implementação. Esta implementação pode ser chamada via mecanismo da " ":func:`super` da classe que a substitui. Isto pode ser útil como um ponto " "final para uma super chamada em um framework que usa herança múltipla " "cooperativa. " #: ../../library/abc.rst:170 msgid "" "A subclass of the built-in :func:`property`, indicating an abstract " "property." msgstr "" "Uma subclasse da :func:`property` embutida, indicando uma propriedade " "abstrata." #: ../../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 "" #: ../../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 "" #: ../../library/abc.rst:198 msgid "Footnotes" msgstr "Notas de Rodapé" #: ../../library/abc.rst:199 msgid "" "C++ programmers should note that Python's virtual base class concept is not " "the same as C++'s." msgstr "" "Programadores C++ devem notar que o conceito da casse base virtual do Python" " não é o mesmo que o de C++. "