diff --git a/dictionaries/library_typing.txt b/dictionaries/library_typing.txt index 3ce8cbcca5..8a9980ad1f 100644 --- a/dictionaries/library_typing.txt +++ b/dictionaries/library_typing.txt @@ -1,8 +1,85 @@ +Absolute +Ann +Annotated +Bucket +Combiner +Concatenate +Employee +Generic +Matrix +Movie +Never +Okay +Proto +Revealed +Sip +Starship +Tambien +Ts +Unrelated +Variadic +Vec +Yup +abs +allowed +another +asignacin +backports +bad +bound +broadcast +capitalized +cb +comprobadores +concat +concatenate +cualificador +damage +despues +employees +enterprise +exhaustividad +greet +greetings +hi +inner interdependientes +kind +manner +maxitems +maxlen +movie +mutate +my +never +numbers +overrides +predicate +prints +proper +provides +raises +reasignaciones +results +retroadaptación +retroportaciones +reveal +revealed +scalar +second +servers +status +team +there tipificación +together +tup +two +typeddict +typo +usuarie variádico variádicos -cualificador -usuarie -exhaustividad -backports +veficiación +way +year diff --git a/library/typing.po b/library/typing.po index 37e33faa92..3a3a7c0590 100644 --- a/library/typing.po +++ b/library/typing.po @@ -11,15 +11,16 @@ msgstr "" "Project-Id-Version: Python 3.8\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-11-21 16:38-0300\n" -"PO-Revision-Date: 2024-11-21 11:04-0500\n" -"Last-Translator: Alfonso Areiza Guerra \n" -"Language: es\n" +"PO-Revision-Date: 2025-10-14 12:43+0200\n" +"Last-Translator: Cristián Maureira-Fredes \n" "Language-Team: python-doc-es\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Language: es\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" "Generated-By: Babel 2.16.0\n" +"X-Generator: Poedit 3.6\n" #: ../Doc/library/typing.rst:3 msgid ":mod:`typing` --- Support for type hints" @@ -30,38 +31,44 @@ msgid "**Source code:** :source:`Lib/typing.py`" msgstr "**Source code:** :source:`Lib/typing.py`" #: ../Doc/library/typing.rst:20 -#, fuzzy msgid "" "The Python runtime does not enforce function and variable type annotations. " "They can be used by third party tools such as :term:`type checkers `, IDEs, linters, etc." msgstr "" -"En tiempo de ejecución, Python no impone las anotaciones de tipado en " -"funciones y variables. Pueden ser utilizadas por herramientas de terceros " -"como validadores de tipado, IDEs, linters, etc." +"El entorno de ejecución de Python no exige anotaciones de tipos de funciones " +"y variables. Pueden ser utilizadas por herramientas de terceros " +"como :term:`type checkers `, IDE, linters, etc." #: ../Doc/library/typing.rst:26 -#, fuzzy msgid "This module provides runtime support for type hints." -msgstr ":mod:`typing` --- Soporte para *type hints*" +msgstr "" +"Este módulo proporciona soporte en tiempo de ejecución para sugerencias de " +"tipo." #: ../Doc/library/typing.rst:28 msgid "Consider the function below::" -msgstr "" +msgstr "Considere la función a continuación::" #: ../Doc/library/typing.rst:30 msgid "" "def surface_area_of_cube(edge_length: float) -> str:\n" " return f\"The surface area of the cube is {6 * edge_length ** 2}.\"" msgstr "" +"def surface_area_of_cube(edge_length: float) -> str:\n" +" return f\"The surface area of the cube is {6 * edge_length ** 2}.\"" #: ../Doc/library/typing.rst:33 msgid "" "The function ``surface_area_of_cube`` takes an argument expected to be an " "instance of :class:`float`, as indicated by the :term:`type hint` " -"``edge_length: float``. The function is expected to return an instance of :" -"class:`str`, as indicated by the ``-> str`` hint." +"``edge_length: float``. The function is expected to return an instance " +"of :class:`str`, as indicated by the ``-> str`` hint." msgstr "" +"La función ``surface_area_of_cube`` toma un argumento que se espera que sea " +"una instancia de :class:`float`, como lo indica :term:`type hint` " +"``edge_length: float``. Se espera que la función devuelva una instancia " +"de :class:`str`, como lo indica la sugerencia ``-> str``." #: ../Doc/library/typing.rst:38 msgid "" @@ -69,18 +76,20 @@ msgid "" "they can also be more complex. The :mod:`typing` module provides a " "vocabulary of more advanced type hints." msgstr "" +"Si bien las sugerencias de tipos pueden ser clases simples " +"como :class:`float` o :class:`str`, también pueden ser más complejas. El " +"módulo :mod:`typing` proporciona un vocabulario de sugerencias de tipos más " +"avanzadas." #: ../Doc/library/typing.rst:42 -#, fuzzy msgid "" -"New features are frequently added to the ``typing`` module. The :pypi:" -"`typing_extensions` package provides backports of these new features to " -"older versions of Python." +"New features are frequently added to the ``typing`` module. " +"The :pypi:`typing_extensions` package provides backports of these new " +"features to older versions of Python." msgstr "" -"Frecuentemente se agregan nuevas funcionalidades al módulo ``typing``. El " -"paquete `typing_extensions `_ " -"provee backports de estas nuevas funcionalidades para versiones más antiguas " -"de Python." +"Con frecuencia se agregan nuevas funciones al módulo ``typing``. El " +"paquete :pypi:`typing_extensions` proporciona versiones anteriores de estas " +"nuevas funciones para versiones anteriores de Python." #: ../Doc/library/typing.rst:49 msgid "" @@ -98,11 +107,11 @@ msgstr "" #: ../Doc/library/typing.rst:54 msgid "" -"\"Type System Reference\" section of `the mypy docs `_" +"\"Type System Reference\" section of `the mypy docs `_" msgstr "" -"Sección “Referencia sobre sistema de tipo” de `the mypy docs `_" +"Sección “Referencia sobre sistema de tipo” de `the mypy docs `_" #: ../Doc/library/typing.rst:52 msgid "" @@ -131,14 +140,17 @@ msgstr "" #: ../Doc/library/typing.rst:64 msgid "Specification for the Python Type System" -msgstr "" +msgstr "Especificación del sistema de tipos de Python" #: ../Doc/library/typing.rst:66 msgid "" "The canonical, up-to-date specification of the Python type system can be " -"found at `\"Specification for the Python type system\" `_." +"found at `\"Specification for the Python type system\" `_." msgstr "" +"La especificación canónica y actualizada del sistema de tipos Python se " +"puede encontrar en `\"Specification for the Python type system\" `_." #: ../Doc/library/typing.rst:72 msgid "Type aliases" @@ -165,6 +177,13 @@ msgid "" "# passes type checking; a list of floats qualifies as a Vector.\n" "new_vector = scale(2.0, [1.0, -4.2, 5.4])" msgstr "" +"type Vector = list[float]\n" +"\n" +"def scale(scalar: float, vector: Vector) -> Vector:\n" +" return [scalar * num for num in vector]\n" +"\n" +"# pasa las verificaciones de tipo; una lista de float califica como Vector.\n" +"new_vector = scale(2.0, [1.0, -4.2, 5.4])" #: ../Doc/library/typing.rst:87 msgid "" @@ -193,6 +212,22 @@ msgid "" ") -> None:\n" " ..." msgstr "" +"from collections.abc import Sequence\n" +"\n" +"type ConnectionOptions = dict[str, str]\n" +"type Address = tuple[str, int]\n" +"type Server = tuple[Address, ConnectionOptions]\n" +"\n" +"def broadcast_message(message: str, servers: Sequence[Server]) -> None:\n" +" ...\n" +"\n" +"# El verificador de tipos estáticos tratará la firma de tipo anterior como\n" +"# exactamente equivalente a esta.\n" +"def broadcast_message(\n" +" message: str,\n" +" servers: Sequence[tuple[tuple[str, int], dict[str, str]]]\n" +") -> None:\n" +" ..." #: ../Doc/library/typing.rst:106 msgid "" @@ -205,7 +240,7 @@ msgstr "" #: ../Doc/library/typing.rst:109 msgid "Vector = list[float]" -msgstr "" +msgstr "Vector = list[float]" #: ../Doc/library/typing.rst:111 msgid "" @@ -221,6 +256,9 @@ msgid "" "\n" "Vector: TypeAlias = list[float]" msgstr "" +"from typing import TypeAlias\n" +"\n" +"Vector: TypeAlias = list[float]" #: ../Doc/library/typing.rst:121 msgid "NewType" @@ -237,6 +275,10 @@ msgid "" "UserId = NewType('UserId', int)\n" "some_id = UserId(524313)" msgstr "" +"from typing import NewType\n" +"\n" +"UserId = NewType('UserId', int)\n" +"some_id = UserId(524313)" #: ../Doc/library/typing.rst:130 msgid "" @@ -257,6 +299,14 @@ msgid "" "# fails type checking; an int is not a UserId\n" "user_b = get_user_name(-1)" msgstr "" +"def get_user_name(user_id: UserId) -> str:\n" +" ...\n" +"\n" +"# pasa la verificación de tipos\n" +"user_a = get_user_name(UserId(42351))\n" +"\n" +"# falla la verificación de tipos; un int no es un UserId\n" +"user_b = get_user_name(-1)" #: ../Doc/library/typing.rst:142 msgid "" @@ -275,6 +325,8 @@ msgid "" "# 'output' is of type 'int', not 'UserId'\n" "output = UserId(23413) + UserId(54341)" msgstr "" +"# 'output' es del tipo 'int', no 'UserId'\n" +"output = UserId(23413) + UserId(54341)" #: ../Doc/library/typing.rst:150 msgid "" @@ -312,6 +364,12 @@ msgid "" "# Fails at runtime and does not pass type checking\n" "class AdminUserId(UserId): pass" msgstr "" +"from typing import NewType\n" +"\n" +"UserId = NewType('UserId', int)\n" +"\n" +"# Falla en runtime y no pasa la verificación de tipos\n" +"class AdminUserId(UserId): pass" #: ../Doc/library/typing.rst:168 msgid "" @@ -329,6 +387,11 @@ msgid "" "\n" "ProUserId = NewType('ProUserId', UserId)" msgstr "" +"from typing import NewType\n" +"\n" +"UserId = NewType('UserId', int)\n" +"\n" +"ProUserId = NewType('ProUserId', UserId)" #: ../Doc/library/typing.rst:176 msgid "and typechecking for ``ProUserId`` will work as expected." @@ -391,17 +454,18 @@ msgid "Annotating callable objects" msgstr "Anotaciones en objetos invocables" #: ../Doc/library/typing.rst:210 -#, fuzzy msgid "" -"Functions -- or other :term:`callable` objects -- can be annotated using :" -"class:`collections.abc.Callable` or deprecated :data:`typing.Callable`. " -"``Callable[[int], str]`` signifies a function that takes a single parameter " -"of type :class:`int` and returns a :class:`str`." +"Functions -- or other :term:`callable` objects -- can be annotated " +"using :class:`collections.abc.Callable` or " +"deprecated :data:`typing.Callable`. ``Callable[[int], str]`` signifies a " +"function that takes a single parameter of type :class:`int` and returns " +"a :class:`str`." msgstr "" -"Las funciones -- u otro objeto invocable :term:`callable` se pueden anotar " -"utilizando :class:`collections.abc.Callable` o :data:`typing.Callable`. " -"``Callable[[int], str]`` se refiere a una función que toma un solo parámetro " -"de tipo :class:`int` y retorna un :class:`str`." +"Las funciones (u otros objetos :term:`callable`) se pueden anotar " +"utilizando :class:`collections.abc.Callable` o el " +"obsoleto :data:`typing.Callable`. ``Callable[[int], str]`` significa una " +"función que toma un único parámetro de tipo :class:`int` y devuelve " +"un :class:`str`." #: ../Doc/library/typing.rst:215 ../Doc/library/typing.rst:3128 #: ../Doc/library/typing.rst:3308 @@ -424,6 +488,19 @@ msgid "" "\n" "callback: Callable[[str], Awaitable[None]] = on_update" msgstr "" +"from collections.abc import Callable, Awaitable\n" +"\n" +"def feeder(get_next_item: Callable[[], str]) -> None:\n" +" ... # Body\n" +"\n" +"def async_query(on_success: Callable[[int], None],\n" +" on_error: Callable[[int, Exception], None]) -> None:\n" +" ... # Body\n" +"\n" +"async def on_update(value: str) -> None:\n" +" ... # Body\n" +"\n" +"callback: Callable[[str], Awaitable[None]] = on_update" #: ../Doc/library/typing.rst:233 msgid "" @@ -434,8 +511,9 @@ msgid "" msgstr "" "La sintaxis de suscripción siempre debe utilizarse con exactamente dos " "valores: una lista de argumentos y el tipo de retorno. La lista de " -"argumentos debe ser una lista de tipos, un :class:`ParamSpec`, :data:" -"`Concatenate` o una elipsis. El tipo de retorno debe ser un único tipo." +"argumentos debe ser una lista de tipos, " +"un :class:`ParamSpec`, :data:`Concatenate` o una elipsis. El tipo de retorno " +"debe ser un único tipo." #: ../Doc/library/typing.rst:238 msgid "" @@ -454,21 +532,26 @@ msgid "" "x = str # OK\n" "x = concat # Also OK" msgstr "" +"def concat(x: str, y: str) -> str:\n" +" return x + y\n" +"\n" +"x: Callable[..., str]\n" +"x = str # OK\n" +"x = concat # Also OK" #: ../Doc/library/typing.rst:250 -#, fuzzy msgid "" "``Callable`` cannot express complex signatures such as functions that take a " "variadic number of arguments, :ref:`overloaded functions `, or " "functions that have keyword-only parameters. However, these signatures can " -"be expressed by defining a :class:`Protocol` class with a :meth:`~object." -"__call__` method:" +"be expressed by defining a :class:`Protocol` class with " +"a :meth:`~object.__call__` method:" msgstr "" -"``Callable`` no puede representar firmas complejas como funciones que toman " -"un número variado de argumentos, :func:`funciones sobrecargadas ` " -"o funciones que reciben parámetros de solo palabras clave. Sin embargo, " -"estas firmas se pueden definir al definir una clase :class:`Protocol` con un " -"método :meth:`~object.__call__` method:" +"``Callable`` no puede expresar firmas complejas, como funciones que toman un " +"número variádico de argumentos, :ref:`overloaded functions ` o " +"funciones que tienen parámetros que solo contienen palabras clave. Sin " +"embargo, estas firmas se pueden expresar definiendo una " +"clase :class:`Protocol` con un método :meth:`~object.__call__`:" #: ../Doc/library/typing.rst:256 msgid "" @@ -493,6 +576,27 @@ msgid "" "of\n" " # different name and kind in the callback" msgstr "" +"from collections.abc import Iterable\n" +"from typing import Protocol\n" +"\n" +"class Combiner(Protocol):\n" +" def __call__(self, *vals: bytes, maxlen: int | None = None) -> " +"list[bytes]: ...\n" +"\n" +"def batch_proc(data: Iterable[bytes], cb_results: Combiner) -> bytes:\n" +" for item in data:\n" +" ...\n" +"\n" +"def good_cb(*vals: bytes, maxlen: int | None = None) -> list[bytes]:\n" +" ...\n" +"def bad_cb(*vals: bytes, maxitems: int | None) -> list[bytes]:\n" +" ...\n" +"\n" +"batch_proc([], good_cb) # OK\n" +"batch_proc([], bad_cb) # Error! El argumento 2 tiene un tipo incompatible " +"debido a\n" +" # nombre y tipo diferentes en la devolución de " +"llamada" #: ../Doc/library/typing.rst:277 msgid "" @@ -505,20 +609,20 @@ msgid "" "ReturnType]`` respectively." msgstr "" "Los invocables que toman otros invocables como argumentos pueden indicar que " -"sus tipos de parámetros dependen unos de otros utilizando :class:" -"`ParamSpec`. Además, si ese invocable agrega o elimina argumentos de otros " -"invocables, se puede utilizar el operador :data:`Concatenate`. Toman la " -"forma ``Callable[ParamSpecVariable, ReturnType]`` y " -"``Callable[Concatenate[Arg1Type, Arg2Type, ..., ParamSpecVariable], " -"ReturnType]`` respectivamente." +"sus tipos de parámetros dependen unos de otros " +"utilizando :class:`ParamSpec`. Además, si ese invocable agrega o elimina " +"argumentos de otros invocables, se puede utilizar el " +"operador :data:`Concatenate`. Toman la forma ``Callable[ParamSpecVariable, " +"ReturnType]`` y ``Callable[Concatenate[Arg1Type, Arg2Type, ..., " +"ParamSpecVariable], ReturnType]`` respectivamente." #: ../Doc/library/typing.rst:285 ../Doc/library/typing.rst:3798 msgid "" -"``Callable`` now supports :class:`ParamSpec` and :data:`Concatenate`. See :" -"pep:`612` for more details." +"``Callable`` now supports :class:`ParamSpec` and :data:`Concatenate`. " +"See :pep:`612` for more details." msgstr "" -"``Callable`` ahora es compatible con :class:`ParamSpec` y :data:" -"`Concatenate`. Consulte :pep:`612` para obtener más información." +"``Callable`` ahora es compatible con :class:`ParamSpec` " +"y :data:`Concatenate`. Consulte :pep:`612` para obtener más información." #: ../Doc/library/typing.rst:290 msgid "" @@ -556,6 +660,17 @@ msgid "" "def notify_by_email(employees: Sequence[Employee],\n" " overrides: Mapping[str, str]) -> None: ..." msgstr "" +"from collections.abc import Mapping, Sequence\n" +"\n" +"class Employee: ...\n" +"\n" +"# Sequence[Employee] indica que todos los elementos de la secuencia\n" +"# deben ser instancias de \"Employee\".\n" +"# Mapping[str, str] indica que todas las claves y todos los valores de la " +"asignación\n" +"# deben ser cadenas.\n" +"def notify_by_email(employees: Sequence[Employee],\n" +" overrides: Mapping[str, str]) -> None: ..." #: ../Doc/library/typing.rst:315 msgid "" @@ -573,6 +688,11 @@ msgid "" "\"T\"\n" " return l[0]" msgstr "" +"from collections.abc import Sequence\n" +"\n" +"def first[T](l: Sequence[T]) -> T: # La función es genérica sobre el " +"TypeVar \"T\"\n" +" return l[0]" #: ../Doc/library/typing.rst:323 msgid "Or by using the :class:`TypeVar` factory directly::" @@ -589,6 +709,14 @@ msgid "" "\"U\"\n" " return l[1]" msgstr "" +"from collections.abc import Sequence\n" +"from typing import TypeVar\n" +"\n" +"U = TypeVar('U') # Declara variable tipo \"U\"\n" +"\n" +"def second(l: Sequence[U]) -> U: # La función es genérica sobre TypeVar " +"\"U\"\n" +" return l[1]" #: ../Doc/library/typing.rst:333 msgid "Syntactic support for generics is new in Python 3.12." @@ -620,26 +748,41 @@ msgid "" "# and that all values in ``z`` are meant to be either strings or ints\n" "z: Mapping[str, str | int] = {}" msgstr "" +"from collections.abc import Mapping\n" +"\n" +"# El verificador de tipos inferirá que todos los elementos en ``x`` deben " +"ser ints\n" +"x: list[int] = []\n" +"\n" +"#Error del verificador de tipo: ``list`` solo acepta un único argumento de " +"tipo:\n" +"y: list[int, str] = [1, 'foo']\n" +"\n" +"# El verificador de tipos inferirá que todas las claves en ``z`` deben ser " +"strings,\n" +"# y que todos los valores en ``z`` deben ser strings o ints\n" +"z: Mapping[str, str | int] = {}" #: ../Doc/library/typing.rst:356 msgid "" ":class:`list` only accepts one type argument, so a type checker would emit " -"an error on the ``y`` assignment above. Similarly, :class:`~collections.abc." -"Mapping` only accepts two type arguments: the first indicates the type of " -"the keys, and the second indicates the type of the values." +"an error on the ``y`` assignment above. " +"Similarly, :class:`~collections.abc.Mapping` only accepts two type " +"arguments: the first indicates the type of the keys, and the second " +"indicates the type of the values." msgstr "" ":class:`list` solo acepta un argumento de tipo, por lo que un validador de " -"tipos emitiría un error en la asignación ``y`` anterior. De manera similar, :" -"class:`~collections.abc.Mapping` solo acepta dos argumentos de tipo: el " -"primero indica el tipo de las claves y el segundo indica el tipo de los " -"valores." +"tipos emitiría un error en la asignación ``y`` anterior. De manera " +"similar, :class:`~collections.abc.Mapping` solo acepta dos argumentos de " +"tipo: el primero indica el tipo de las claves y el segundo indica el tipo de " +"los valores." #: ../Doc/library/typing.rst:362 msgid "" "Unlike most other Python containers, however, it is common in idiomatic " "Python code for tuples to have elements which are not all of the same type. " -"For this reason, tuples are special-cased in Python's typing system. :class:" -"`tuple` accepts *any number* of type arguments::" +"For this reason, tuples are special-cased in Python's typing " +"system. :class:`tuple` accepts *any number* of type arguments::" msgstr "" "Sin embargo, a diferencia de la mayoría de los demás contenedores de Python, " "es común en el código idiomático de Python que las tuplas tengan elementos " @@ -661,6 +804,17 @@ msgid "" "# but ``z`` has been assigned to a tuple of length 3\n" "z: tuple[int] = (1, 2, 3)" msgstr "" +"# OK: ``x`` se asigna a una tupla de longitud 1 donde el único elemento es " +"un int\n" +"x: tuple[int] = (5,)\n" +"\n" +"# OK: ``y`` se asigna a una tupla de longitud 2;\n" +"# el elemento 1 es un int, el elemento 2 es una cadena\n" +"y: tuple[int, str] = (5, \"foo\")\n" +"\n" +"# Error: la anotación de tipo indica una tupla de longitud 1,\n" +"# pero ``z`` se ha asignado a una tupla de longitud 3\n" +"z: tuple[int] = (1, 2, 3)" #: ../Doc/library/typing.rst:378 msgid "" @@ -693,23 +847,40 @@ msgid "" "z = (1, 2, 3)\n" "z = ()" msgstr "" +"x: tuple[int, ...] = (1, 2)\n" +"# Estas reasignaciones están bien: ``tuple[int, ...]`` indica que x puede " +"tener cualquier longitud\n" +"x = (1, 2, 3)\n" +"x = ()\n" +"# Esta reasignación es un error: todos los elementos en ``x`` deben ser " +"enteros\n" +"x = (\"foo\", \"bar\")\n" +"\n" +"# ``y`` solo se puede asignar a una tupla vacía\n" +"y: tuple[()] = ()\n" +"\n" +"z: tuple = (\"foo\", \"bar\")\n" +"# Estas reasignaciones están bien: una ``tupla`` simple es equivalente a " +"``tuple[Any, ...]``\n" +"z = (1, 2, 3)\n" +"z = ()" #: ../Doc/library/typing.rst:401 msgid "The type of class objects" msgstr "El tipo de objetos de clase" #: ../Doc/library/typing.rst:403 -#, fuzzy msgid "" "A variable annotated with ``C`` may accept a value of type ``C``. In " -"contrast, a variable annotated with ``type[C]`` (or deprecated :class:" -"`typing.Type[C] `) may accept values that are classes themselves -- " -"specifically, it will accept the *class object* of ``C``. For example::" +"contrast, a variable annotated with ``type[C]`` (or " +"deprecated :class:`typing.Type[C] `) may accept values that are " +"classes themselves -- specifically, it will accept the *class object* of " +"``C``. For example::" msgstr "" "Una variable anotada con ``C`` puede aceptar un valor de tipo ``C``. Por el " "contrario, una variable anotada con ``type[C]`` (o :class:`typing.Type[C] " -"`) puede aceptar valores que sean clases en sí mismas; " -"específicamente, aceptará el *objeto de clase* de ``C``. Por ejemplo:" +"` en desuso) puede aceptar valores que sean clases en sí mismos; " +"específicamente, aceptará el *class object* de ``C``. Por ejemplo:" #: ../Doc/library/typing.rst:409 msgid "" @@ -717,6 +888,9 @@ msgid "" "b = int # Has type ``type[int]``\n" "c = type(a) # Also has type ``type[int]``" msgstr "" +"a = 3 # Tiene tipo ``int``\n" +"b = int # Tiene tipo ``type[int]``\n" +"c = type(a) # Tambien tiene tipo ``type[int]``" #: ../Doc/library/typing.rst:413 msgid "Note that ``type[C]`` is covariant::" @@ -740,15 +914,32 @@ msgid "" "make_new_user(int) # Error: ``type[int]`` is not a subtype of " "``type[User]``" msgstr "" +"class User: ...\n" +"class ProUser(User): ...\n" +"class TeamUser(User): ...\n" +"\n" +"def make_new_user(user_class: type[User]) -> User:\n" +" # ...\n" +" return user_class()\n" +"\n" +"make_new_user(User) # OK\n" +"make_new_user(ProUser) # También OK: ``type[ProUser]`` es un subtipo de " +"``type[User]``\n" +"make_new_user(TeamUser) # aún está bien\n" +"make_new_user(User()) # Error: se espera ``type[User]`` pero se usó " +"``User``\n" +"make_new_user(int) # Error: ``type[int]`` no es un subtipo de " +"``type[User]``" #: ../Doc/library/typing.rst:429 msgid "" -"The only legal parameters for :class:`type` are classes, :data:`Any`, :ref:" -"`type variables `, and unions of any of these types. For example::" +"The only legal parameters for :class:`type` are " +"classes, :data:`Any`, :ref:`type variables `, and unions of any of " +"these types. For example::" msgstr "" -"Los únicos parámetros legales para :class:`type` son las clases, :data:" -"`Any`, :ref:`variables de tipo ` y uniones de cualquiera de estos " -"tipos. Por ejemplo::" +"Los únicos parámetros legales para :class:`type` son las " +"clases, :data:`Any`, :ref:`variables de tipo ` y uniones de " +"cualquiera de estos tipos. Por ejemplo::" #: ../Doc/library/typing.rst:433 msgid "" @@ -760,28 +951,35 @@ msgid "" " # of ``type[BasicUser | ProUser]``\n" "new_non_team_user(User) # Also an error" msgstr "" +"def new_non_team_user(user_class: type[BasicUser | ProUser]): ...\n" +"\n" +"new_non_team_user(BasicUser) # OK\n" +"new_non_team_user(ProUser) # OK\n" +"new_non_team_user(TeamUser) # Error: ``type[TeamUser]`` no es un subtipo\n" +" # de ``type[BasicUser | ProUser]``\n" +"new_non_team_user(User) # También un error" #: ../Doc/library/typing.rst:441 msgid "" -"``type[Any]`` is equivalent to :class:`type`, which is the root of Python's :" -"ref:`metaclass hierarchy `." +"``type[Any]`` is equivalent to :class:`type`, which is the root of " +"Python's :ref:`metaclass hierarchy `." msgstr "" -"``type[Any]`` es equivalente a :class:`type`, que es la raíz de la :ref:" -"`jerarquía de metaclases ` de Python." +"``type[Any]`` es equivalente a :class:`type`, que es la raíz de " +"la :ref:`jerarquía de metaclases ` de Python." #: ../Doc/library/typing.rst:448 msgid "Annotating generators and coroutines" -msgstr "" +msgstr "Anotación de generadores y corrutinas" #: ../Doc/library/typing.rst:450 -#, fuzzy msgid "" -"A generator can be annotated using the generic type :class:" -"`Generator[YieldType, SendType, ReturnType] `. " -"For example::" +"A generator can be annotated using the generic " +"type :class:`Generator[YieldType, SendType, ReturnType] " +"`. For example::" msgstr "" -"Un generador puede ser anotado con el tipo genérico ``Generator[YieldType, " -"SendType, ReturnType]``. Por ejemplo::" +"Se puede anotar un generador utilizando el tipo " +"genérico :class:`Generator[YieldType, SendType, ReturnType] " +"`. Por ejemplo:" #: ../Doc/library/typing.rst:454 msgid "" @@ -791,22 +989,28 @@ msgid "" " sent = yield round(sent)\n" " return 'Done'" msgstr "" +"def echo_round() -> Generator[int, float, str]:\n" +" sent = yield 0\n" +" while sent >= 0:\n" +" sent = yield round(sent)\n" +" return 'Done'" #: ../Doc/library/typing.rst:460 -#, fuzzy msgid "" "Note that unlike many other generic classes in the standard library, the " "``SendType`` of :class:`~collections.abc.Generator` behaves contravariantly, " "not covariantly or invariantly." msgstr "" -"Nótese que en contraste con muchos otros genéricos en el módulo *typing*, el " -"``SendType`` de :class:`Generator` se comporta como contravariante, no " -"covariante ni invariante." +"Tenga en cuenta que, a diferencia de muchas otras clases genéricas en la " +"biblioteca estándar, ``SendType`` de :class:`~collections.abc.Generator` se " +"comporta de manera contravariante, no covariante o invariante." #: ../Doc/library/typing.rst:464 msgid "" "The ``SendType`` and ``ReturnType`` parameters default to :const:`!None`::" msgstr "" +"Los parámetros ``SendType`` y ``ReturnType`` tienen como valor " +"predeterminado :const:`!None`::" #: ../Doc/library/typing.rst:466 msgid "" @@ -815,10 +1019,14 @@ msgid "" " yield start\n" " start += 1" msgstr "" +"def infinite_stream(start: int) -> Generator[int]:\n" +" while True:\n" +" yield start\n" +" start += 1" #: ../Doc/library/typing.rst:471 msgid "It is also possible to set these types explicitly::" -msgstr "" +msgstr "También es posible configurar estos tipos explícitamente:" #: ../Doc/library/typing.rst:473 msgid "" @@ -827,13 +1035,22 @@ msgid "" " yield start\n" " start += 1" msgstr "" +"def infinite_stream(start: int) -> Generator[int, None, None]:\n" +" while True:\n" +" yield start\n" +" start += 1" #: ../Doc/library/typing.rst:478 msgid "" "Simple generators that only ever yield values can also be annotated as " -"having a return type of either :class:`Iterable[YieldType] ` or :class:`Iterator[YieldType] `::" +"having a return type of either :class:`Iterable[YieldType] " +"` or :class:`Iterator[YieldType] " +"`::" msgstr "" +"Los generadores simples que solo producen valores también se pueden anotar " +"como que tienen un tipo de retorno de :class:`Iterable[YieldType] " +"` o :class:`Iterator[YieldType] " +"`::" #: ../Doc/library/typing.rst:483 msgid "" @@ -842,14 +1059,23 @@ msgid "" " yield start\n" " start += 1" msgstr "" +"def infinite_stream(start: int) -> Iterator[int]:\n" +" while True:\n" +" yield start\n" +" start += 1" #: ../Doc/library/typing.rst:488 msgid "" "Async generators are handled in a similar fashion, but don't expect a " "``ReturnType`` type argument (:class:`AsyncGenerator[YieldType, SendType] " -"`). The ``SendType`` argument defaults to :" -"const:`!None`, so the following definitions are equivalent::" +"`). The ``SendType`` argument defaults " +"to :const:`!None`, so the following definitions are equivalent::" msgstr "" +"Los generadores asincrónicos se manejan de manera similar, pero no espere un " +"argumento de tipo ``ReturnType`` (:class:`AsyncGenerator[YieldType, " +"SendType] `). El argumento ``SendType`` " +"tiene como valor predeterminado :const:`!None`, por lo que las siguientes " +"definiciones son equivalentes:" #: ../Doc/library/typing.rst:494 msgid "" @@ -863,13 +1089,26 @@ msgid "" " yield start\n" " start = await increment(start)" msgstr "" +"async def infinite_stream(start: int) -> AsyncGenerator[int]:\n" +" while True:\n" +" yield start\n" +" start = await increment(start)\n" +"\n" +"async def infinite_stream(start: int) -> AsyncGenerator[int, None]:\n" +" while True:\n" +" yield start\n" +" start = await increment(start)" #: ../Doc/library/typing.rst:504 msgid "" -"As in the synchronous case, :class:`AsyncIterable[YieldType] ` and :class:`AsyncIterator[YieldType] ` are available as well::" +"As in the synchronous case, :class:`AsyncIterable[YieldType] " +"` and :class:`AsyncIterator[YieldType] " +"` are available as well::" msgstr "" +"Al igual que en el caso sincrónico, también están " +"disponibles :class:`AsyncIterable[YieldType] " +"` y :class:`AsyncIterator[YieldType] " +"`:" #: ../Doc/library/typing.rst:509 msgid "" @@ -878,6 +1117,10 @@ msgid "" " yield start\n" " start = await increment(start)" msgstr "" +"async def infinite_stream(start: int) -> AsyncIterator[int]:\n" +" while True:\n" +" yield start\n" +" start = await increment(start)" #: ../Doc/library/typing.rst:514 msgid "" @@ -885,6 +1128,9 @@ msgid "" "ReturnType] `. Generic arguments correspond to " "those of :class:`~collections.abc.Generator`, for example::" msgstr "" +"Las corrutinas se pueden anotar utilizando :class:`Coroutine[YieldType, " +"SendType, ReturnType] `. Los argumentos genéricos " +"corresponden a los de :class:`~collections.abc.Generator`, por ejemplo:" #: ../Doc/library/typing.rst:519 msgid "" @@ -894,6 +1140,12 @@ msgid "" "async def bar() -> None:\n" " y = await c # Inferred type of 'y' is int" msgstr "" +"from collections.abc import Coroutine\n" +"c: Coroutine[list[str], str, int] # Algunas corrutinas definidas en otro " +"lugar\n" +"x = c.send('hi') # El tipo inferido de 'x' es list[str]\n" +"async def bar() -> None:\n" +" y = await c # El tipo inferido de 'y' es int" #: ../Doc/library/typing.rst:528 msgid "User-defined generic types" @@ -926,23 +1178,40 @@ msgid "" " def log(self, message: str) -> None:\n" " self.logger.info('%s: %s', self.name, message)" msgstr "" +"from logging import Logger\n" +"\n" +"class LoggedVar[T]:\n" +" def __init__(self, value: T, name: str, logger: Logger) -> None:\n" +" self.name = name\n" +" self.logger = logger\n" +" self.value = value\n" +"\n" +" def set(self, new: T) -> None:\n" +" self.log('Set ' + repr(self.value))\n" +" self.value = new\n" +"\n" +" def get(self) -> T:\n" +" self.log('Get ' + repr(self.value))\n" +" return self.value\n" +"\n" +" def log(self, message: str) -> None:\n" +" self.logger.info('%s: %s', self.name, message)" #: ../Doc/library/typing.rst:553 -#, fuzzy msgid "" "This syntax indicates that the class ``LoggedVar`` is parameterised around a " "single :ref:`type variable ` ``T`` . This also makes ``T`` valid as " "a type within the class body." msgstr "" "Esta sintaxis indica que la clase ``LoggedVar`` está parametrizada en torno " -"a una única variable de tipo :class:`` ``T`` . Esto también hace " -"que ``T`` sea válida como tipo dentro del cuerpo de la clase." +"a un único :ref:`type variable ` ``T`` . Esto también hace que " +"``T`` sea válido como tipo dentro del cuerpo de la clase." #: ../Doc/library/typing.rst:557 msgid "" "Generic classes implicitly inherit from :class:`Generic`. For compatibility " -"with Python 3.11 and lower, it is also possible to inherit explicitly from :" -"class:`Generic` to indicate a generic class::" +"with Python 3.11 and lower, it is also possible to inherit explicitly " +"from :class:`Generic` to indicate a generic class::" msgstr "" "Las clases genéricas heredan implícitamente de :class:`Generic`. Para " "compatibilidad con Python 3.11 y versiones anteriores, también es posible " @@ -957,6 +1226,12 @@ msgid "" "class LoggedVar(Generic[T]):\n" " ..." msgstr "" +"from typing import TypeVar, Generic\n" +"\n" +"T = TypeVar('T')\n" +"\n" +"class LoggedVar(Generic[T]):\n" +" ..." #: ../Doc/library/typing.rst:568 msgid "" @@ -975,11 +1250,16 @@ msgid "" " for var in vars:\n" " var.set(0)" msgstr "" +"from collections.abc import Iterable\n" +"\n" +"def zero_all_vars(vars: Iterable[LoggedVar[int]]) -> None:\n" +" for var in vars:\n" +" var.set(0)" #: ../Doc/library/typing.rst:577 msgid "" -"A generic type can have any number of type variables. All varieties of :" -"class:`TypeVar` are permissible as parameters for a generic type::" +"A generic type can have any number of type variables. All varieties " +"of :class:`TypeVar` are permissible as parameters for a generic type::" msgstr "" "Un tipo genérico puede tener un numero cualquiera de variables de tipo. Se " "permiten todas las variaciones de :class:`TypeVar` para ser usadas como " @@ -999,6 +1279,17 @@ msgid "" "class OldWeirdTrio(Generic[OldT, OldB, OldS]):\n" " ..." msgstr "" +"from typing import TypeVar, Generic, Sequence\n" +"\n" +"class WeirdTrio[T, B: Sequence[bytes], S: (int, str)]:\n" +" ...\n" +"\n" +"OldT = TypeVar('OldT', contravariant=True)\n" +"OldB = TypeVar('OldB', bound=Sequence[bytes], covariant=True)\n" +"OldS = TypeVar('OldS', int, str)\n" +"\n" +"class OldWeirdTrio(Generic[OldT, OldB, OldS]):\n" +" ..." #: ../Doc/library/typing.rst:592 msgid "" @@ -1021,6 +1312,16 @@ msgid "" "class Pair(Generic[T, T]): # INVALID\n" " ..." msgstr "" +"from typing import TypeVar, Generic\n" +"...\n" +"\n" +"class Pair[M, M]: # SyntaxError\n" +" ...\n" +"\n" +"T = TypeVar('T')\n" +"\n" +"class Pair(Generic[T, T]): # INVALID\n" +" ..." #: ../Doc/library/typing.rst:606 msgid "Generic classes can also inherit from other classes::" @@ -1033,6 +1334,10 @@ msgid "" "class LinkedList[T](Sized):\n" " ..." msgstr "" +"from collections.abc import Sized\n" +"\n" +"class LinkedList[T](Sized):\n" +" ..." #: ../Doc/library/typing.rst:613 msgid "" @@ -1047,6 +1352,10 @@ msgid "" "class MyDict[T](Mapping[str, T]):\n" " ..." msgstr "" +"from collections.abc import Mapping\n" +"\n" +"class MyDict[T](Mapping[str, T]):\n" +" ..." #: ../Doc/library/typing.rst:620 msgid "In this case ``MyDict`` has a single parameter, ``T``." @@ -1058,9 +1367,10 @@ msgid "" "for each position. In the following example, ``MyIterable`` is not generic " "but implicitly inherits from ``Iterable[Any]``:" msgstr "" -"El uso de una clase genérica sin especificar parámetros de tipo supone :data:" -"`Any` para cada posición. En el siguiente ejemplo, ``MyIterable`` no es " -"genérico, sino que hereda implícitamente de ``Iterable[Any]``:" +"El uso de una clase genérica sin especificar parámetros de tipo " +"supone :data:`Any` para cada posición. En el siguiente ejemplo, " +"``MyIterable`` no es genérico, sino que hereda implícitamente de " +"``Iterable[Any]``:" #: ../Doc/library/typing.rst:626 msgid "" @@ -1069,6 +1379,10 @@ msgid "" "class MyIterable(Iterable): # Same as Iterable[Any]\n" " ..." msgstr "" +"from collections.abc import Iterable\n" +"\n" +"class MyIterable(Iterable): # Igual que Iterable[Any]\n" +" ..." #: ../Doc/library/typing.rst:633 msgid "User-defined generic type aliases are also supported. Examples::" @@ -1092,6 +1406,19 @@ msgid "" "Iterable[tuple[T, T]]\n" " return sum(x*y for x, y in v)" msgstr "" +"from collections.abc import Iterable\n" +"\n" +"type Response[S] = Iterable[S] | int\n" +"\n" +"# Return type here is same as Iterable[str] | int\n" +"def response(query: str) -> Response[str]:\n" +" ...\n" +"\n" +"type Vec[T] = Iterable[tuple[T, T]]\n" +"\n" +"def inproduct[T: (int, float, complex)](v: Vec[T]) -> T: # Same as " +"Iterable[tuple[T, T]]\n" +" return sum(x*y for x, y in v)" #: ../Doc/library/typing.rst:648 msgid "" @@ -1109,6 +1436,11 @@ msgid "" "S = TypeVar(\"S\")\n" "Response = Iterable[S] | int" msgstr "" +"from collections.abc import Iterable\n" +"from typing import TypeVar\n" +"\n" +"S = TypeVar(\"S\")\n" +"Response = Iterable[S] | int" #: ../Doc/library/typing.rst:657 msgid ":class:`Generic` no longer has a custom metaclass." @@ -1148,6 +1480,10 @@ msgid "" ">>> Z[int, [dict, float]]\n" "__main__.Z[int, [dict, float]]" msgstr "" +">>> class Z[T, **P]: ... # T es un TypeVar; P es un ParamSpec\n" +"...\n" +">>> Z[int, [dict, float]]\n" +"__main__.Z[int, [dict, float]]" #: ../Doc/library/typing.rst:676 msgid "" @@ -1166,6 +1502,12 @@ msgid "" "class Z(Generic[P]):\n" " ..." msgstr "" +"from typing import ParamSpec, Generic\n" +"\n" +"P = ParamSpec('P')\n" +"\n" +"class Z(Generic[P]):\n" +" ..." #: ../Doc/library/typing.rst:686 msgid "" @@ -1190,6 +1532,12 @@ msgid "" ">>> X[[int, str]]\n" "__main__.X[[int, str]]" msgstr "" +">>> class X[**P]: ...\n" +"...\n" +">>> X[int, str]\n" +"__main__.X[[int, str]]\n" +">>> X[[int, str]]\n" +"__main__.X[[int, str]]" #: ../Doc/library/typing.rst:699 msgid "" @@ -1203,8 +1551,8 @@ msgstr "" #: ../Doc/library/typing.rst:703 msgid "" -":class:`Generic` can now be parameterized over parameter expressions. See :" -"class:`ParamSpec` and :pep:`612` for more details." +":class:`Generic` can now be parameterized over parameter expressions. " +"See :class:`ParamSpec` and :pep:`612` for more details." msgstr "" ":class:`Generic` ahora se puede parametrizar sobre expresiones de " "parámetros. Consulte :class:`ParamSpec` y :pep:`612` para obtener más " @@ -1214,8 +1562,8 @@ msgstr "" msgid "" "A user-defined generic class can have ABCs as base classes without a " "metaclass conflict. Generic metaclasses are not supported. The outcome of " -"parameterizing generics is cached, and most types in the typing module are :" -"term:`hashable` and comparable for equality." +"parameterizing generics is cached, and most types in the typing module " +"are :term:`hashable` and comparable for equality." msgstr "" "Una clase genérica definida por el usuario puede tener clases ABC sin que se " "produzca un conflicto de metaclases. No se admiten metaclases genéricas. El " @@ -1262,14 +1610,28 @@ msgid "" " item.bar()\n" " ..." msgstr "" +"from typing import Any\n" +"\n" +"a: Any = None\n" +"a = [] # OK\n" +"a = 2 # OK\n" +"\n" +"s: str = ''\n" +"s = a # OK\n" +"\n" +"def foo(item: Any) -> int:\n" +" # Pasa la verificación de tipos; 'item' puede ser de cualquier tipo,\n" +" # y ese tipo puede tener el método 'bar'\n" +" item.bar()\n" +" ..." #: ../Doc/library/typing.rst:738 msgid "" -"Notice that no type checking is performed when assigning a value of type :" -"data:`Any` to a more precise type. For example, the static type checker did " -"not report an error when assigning ``a`` to ``s`` even though ``s`` was " -"declared to be of type :class:`str` and receives an :class:`int` value at " -"runtime!" +"Notice that no type checking is performed when assigning a value of " +"type :data:`Any` to a more precise type. For example, the static type " +"checker did not report an error when assigning ``a`` to ``s`` even though " +"``s`` was declared to be of type :class:`str` and receives an :class:`int` " +"value at runtime!" msgstr "" "Nótese que no se realiza comprobación de tipo cuando se asigna un valor de " "tipo :data:`Any` a un tipo más preciso. Por ejemplo, el Validador estático " @@ -1297,6 +1659,15 @@ msgid "" " ...\n" " return data" msgstr "" +"def legacy_parser(text):\n" +" ...\n" +" return data\n" +"\n" +"# Un verificador de tipos estáticos tratará\n" +"# lo anterior como si tuviera la misma firma que:\n" +"def legacy_parser(text: Any) -> Any:\n" +" ...\n" +" return data" #: ../Doc/library/typing.rst:757 msgid "" @@ -1315,8 +1686,8 @@ msgid "" msgstr "" "Compárese el comportamiento de :data:`Any` con el de :class:`object`. De " "manera similar a :data:`Any`, todo tipo es un subtipo de :class:`object`. " -"Sin embargo, en oposición a :data:`Any`, lo contrario no es cierto: :class:" -"`object` *no* es un subtipo de ningún otro tipo." +"Sin embargo, en oposición a :data:`Any`, lo contrario no es " +"cierto: :class:`object` *no* es un subtipo de ningún otro tipo." #: ../Doc/library/typing.rst:765 msgid "" @@ -1350,6 +1721,26 @@ msgid "" "hash_b(42)\n" "hash_b(\"foo\")" msgstr "" +"def hash_a(item: object) -> int:\n" +" # No pasa la comprobación de tipos; un objeto no tiene un método " +"\"mágico\".\n" +" item.magic()\n" +" ...\n" +"\n" +"def hash_b(item: Any) -> int:\n" +" # Pasa la veficiación de tipos\n" +" item.magic()\n" +" ...\n" +"\n" +"# Pasa la verificación de tipo, ya que los ints y str son subclases de " +"objeto\n" +"hash_a(42)\n" +"hash_a(\"foo\")\n" +"\n" +"# Pasa la verificación de tipo, ya que Any es compatible con todos los " +"tipos\n" +"hash_b(42)\n" +"hash_b(\"foo\")" #: ../Doc/library/typing.rst:787 msgid "" @@ -1378,11 +1769,11 @@ msgstr "" # Frase ultracompleja, necesitar una revisión fuerte #: ../Doc/library/typing.rst:798 msgid "" -"This requirement previously also applied to abstract base classes, such as :" -"class:`~collections.abc.Iterable`. The problem with this approach is that a " -"class had to be explicitly marked to support them, which is unpythonic and " -"unlike what one would normally do in idiomatic dynamically typed Python " -"code. For example, this conforms to :pep:`484`::" +"This requirement previously also applied to abstract base classes, such " +"as :class:`~collections.abc.Iterable`. The problem with this approach is " +"that a class had to be explicitly marked to support them, which is " +"unpythonic and unlike what one would normally do in idiomatic dynamically " +"typed Python code. For example, this conforms to :pep:`484`::" msgstr "" "Este requisito también se aplicaba anteriormente a clases base abstractas " "(ABC), tales como :class:`~collections.abc.Iterable`. El problema con esta " @@ -1400,6 +1791,12 @@ msgid "" " def __len__(self) -> int: ...\n" " def __iter__(self) -> Iterator[int]: ..." msgstr "" +"from collections.abc import Sized, Iterable, Iterator\n" +"\n" +"class Bucket(Sized, Iterable[int]):\n" +" ...\n" +" def __len__(self) -> int: ...\n" +" def __iter__(self) -> Iterator[int]: ..." #: ../Doc/library/typing.rst:811 msgid "" @@ -1427,6 +1824,15 @@ msgid "" "def collect(items: Iterable[int]) -> int: ...\n" "result = collect(Bucket()) # Passes type check" msgstr "" +"from collections.abc import Iterator, Iterable\n" +"\n" +"class Bucket: # Nota: sin clases base\n" +" ...\n" +" def __len__(self) -> int: ...\n" +" def __iter__(self) -> Iterator[int]: ...\n" +"\n" +"def collect(items: Iterable[int]) -> int: ...\n" +"result = collect(Bucket()) # Pasa la verificación de tipos" #: ../Doc/library/typing.rst:827 msgid "" @@ -1498,7 +1904,7 @@ msgstr "Definición::" #: ../Doc/library/typing.rst:863 msgid "AnyStr = TypeVar('AnyStr', str, bytes)" -msgstr "" +msgstr "AnyStr = TypeVar('AnyStr', str, bytes)" #: ../Doc/library/typing.rst:865 msgid "" @@ -1526,12 +1932,19 @@ msgid "" "concat(b\"foo\", b\"bar\") # OK, output has type 'bytes'\n" "concat(\"foo\", b\"bar\") # Error, cannot mix str and bytes" msgstr "" +"def concat(a: AnyStr, b: AnyStr) -> AnyStr:\n" +" return a + b\n" +"\n" +"concat(\"foo\", \"bar\") # OK, output tiene tipo 'str'\n" +"concat(b\"foo\", b\"bar\") # OK, output tiene tipo 'bytes'\n" +"concat(\"foo\", b\"bar\") # Error, no se puede mezclar str y bytes" #: ../Doc/library/typing.rst:877 msgid "" -"Note that, despite its name, ``AnyStr`` has nothing to do with the :class:" -"`Any` type, nor does it mean \"any string\". In particular, ``AnyStr`` and " -"``str | bytes`` are different from each other and have different use cases::" +"Note that, despite its name, ``AnyStr`` has nothing to do with " +"the :class:`Any` type, nor does it mean \"any string\". In particular, " +"``AnyStr`` and ``str | bytes`` are different from each other and have " +"different use cases::" msgstr "" "Tenga en cuenta que, a pesar de su nombre, ``AnyStr`` no tiene nada que ver " "con el tipo :class:`Any`, ni significa “cualquier cadena de caracteres”. En " @@ -1550,13 +1963,25 @@ msgid "" "def greet_proper(cond: bool) -> str | bytes:\n" " return \"hi there!\" if cond else b\"greetings!\"" msgstr "" +"# Uso inválido de AnyStr:\n" +"# La variable de tipo se usa solo una vez en la firma de la función,\n" +"# por lo que el verificador de tipos no puede resolverla.\n" +"def greet_bad(cond: bool) -> AnyStr:\n" +" return \"hi there!\" if cond else b\"greetings!\"\n" +"\n" +"# La mejor manera de anotar esta función:\n" +"def greet_proper(cond: bool) -> str | bytes:\n" +" return \"hi there!\" if cond else b\"greetings!\"" #: ../Doc/library/typing.rst:892 msgid "" "Deprecated in favor of the new :ref:`type parameter syntax `. " -"Use ``class A[T: (str, bytes)]: ...`` instead of importing ``AnyStr``. See :" -"pep:`695` for more details." +"Use ``class A[T: (str, bytes)]: ...`` instead of importing ``AnyStr``. " +"See :pep:`695` for more details." msgstr "" +"Obsoleto en favor del nuevo :ref:`type parameter syntax `. " +"Utilice ``class A[T: (str, bytes)]: ...`` en lugar de importar ``AnyStr``. " +"Consulte :pep:`695` para obtener más detalles." #: ../Doc/library/typing.rst:897 msgid "" @@ -1565,6 +1990,10 @@ msgid "" "imported from ``typing``. ``AnyStr`` will be removed from ``typing`` in " "Python 3.18." msgstr "" +"En Python 3.16, ``AnyStr`` se eliminará de ``typing.__all__`` y se emitirán " +"advertencias de desuso en tiempo de ejecución cuando se acceda a él o se " +"importe desde ``typing``. ``AnyStr`` se eliminará de ``typing`` en Python " +"3.18." #: ../Doc/library/typing.rst:904 msgid "Special type that includes only literal strings." @@ -1601,6 +2030,17 @@ msgid "" " f\"SELECT * FROM students WHERE name = {arbitrary_string}\"\n" " )" msgstr "" +"def run_query(sql: LiteralString) -> None:\n" +" ...\n" +"\n" +"def caller(arbitrary_string: str, literal_string: LiteralString) -> None:\n" +" run_query(\"SELECT * FROM students\") # OK\n" +" run_query(literal_string) # OK\n" +" run_query(\"SELECT * FROM \" + literal_string) # OK\n" +" run_query(arbitrary_string) # type checker error\n" +" run_query( # type checker error\n" +" f\"SELECT * FROM students WHERE name = {arbitrary_string}\"\n" +" )" #: ../Doc/library/typing.rst:928 msgid "" @@ -1620,22 +2060,20 @@ msgstr "Véase :pep:`675` para más detalle." # bottom type? #: ../Doc/library/typing.rst:940 -#, fuzzy msgid "" -":data:`!Never` and :data:`!NoReturn` represent the `bottom type `_, a type that has no members." +":data:`!Never` and :data:`!NoReturn` represent the `bottom type `_, a type that has no members." msgstr "" -"El `bottom type `_ (tipo vacío), " -"es un tipo que no tiene miembros." +":data:`!Never` y :data:`!NoReturn` representan `bottom type `_, un tipo que no tiene miembros." -# se añade valor para matizar que la funcion retorna (retorna el control) pero -# no de manera normal. En el ejemplo lanza una excepción. #: ../Doc/library/typing.rst:944 -#, fuzzy msgid "" -"They can be used to indicate that a function never returns, such as :func:" -"`sys.exit`::" -msgstr "Tipo especial que indica que una función nunca retorna un valor." +"They can be used to indicate that a function never returns, such " +"as :func:`sys.exit`::" +msgstr "" +"Se pueden utilizar para indicar que una función nunca retorna, " +"como :func:`sys.exit`::" #: ../Doc/library/typing.rst:947 msgid "" @@ -1644,15 +2082,18 @@ msgid "" "def stop() -> Never:\n" " raise RuntimeError('no way')" msgstr "" +"from typing import Never # o NoReturn\n" +"\n" +"def stop() -> Never:\n" +" raise RuntimeError('no way')" #: ../Doc/library/typing.rst:952 -#, fuzzy msgid "" "Or to define a function that should never be called, as there are no valid " "arguments, such as :func:`assert_never`::" msgstr "" -"Puede ser utilizado para definir una función que nunca debe ser llamada, o " -"una función que nunca retorna::" +"O definir una función que nunca debe llamarse, ya que no hay argumentos " +"válidos, como :func:`assert_never`::" #: ../Doc/library/typing.rst:956 msgid "" @@ -1671,20 +2112,37 @@ msgid "" " case _:\n" " never_call_me(arg) # OK, arg is of type Never (or NoReturn)" msgstr "" +"from typing import Never # o NoReturn\n" +"\n" +"def never_call_me(arg: Never) -> None:\n" +" pass\n" +"\n" +"def int_or_str(arg: int | str) -> None:\n" +" never_call_me(arg) # error del verificador de tipos\n" +" match arg:\n" +" case int():\n" +" print(\"It's an int\")\n" +" case str():\n" +" print(\"It's a str\")\n" +" case _:\n" +" never_call_me(arg) # OK, arg es del tipo Never (o NoReturn)" #: ../Doc/library/typing.rst:971 msgid "" ":data:`!Never` and :data:`!NoReturn` have the same meaning in the type " "system and static type checkers treat both equivalently." msgstr "" +":data:`!Never` y :data:`!NoReturn` tienen el mismo significado en el sistema " +"de tipos y los verificadores de tipos estáticos los tratan a ambos de manera " +"equivalente." #: ../Doc/library/typing.rst:976 msgid "Added :data:`NoReturn`." -msgstr "" +msgstr "Se agregó :data:`NoReturn`." #: ../Doc/library/typing.rst:980 msgid "Added :data:`Never`." -msgstr "" +msgstr "Se agregó :data:`Never`." # ¿cómo se le llama en español a una variable "capturada" en una clausura? #: ../Doc/library/typing.rst:984 @@ -1706,6 +2164,18 @@ msgid "" "reveal_type(SubclassOfFoo().return_self()) # Revealed type is " "\"SubclassOfFoo\"" msgstr "" +"from typing import Self, reveal_type\n" +"\n" +"class Foo:\n" +" def return_self(self) -> Self:\n" +" ...\n" +" return self\n" +"\n" +"class SubclassOfFoo(Foo): pass\n" +"\n" +"reveal_type(Foo().return_self()) # Revealed type is \"Foo\"\n" +"reveal_type(SubclassOfFoo().return_self()) # Tipo revelado es " +"\"SubclassOfFoo\"" #: ../Doc/library/typing.rst:1000 msgid "" @@ -1726,6 +2196,14 @@ msgid "" " ...\n" " return self" msgstr "" +"from typing import TypeVar\n" +"\n" +"Self = TypeVar(\"Self\", bound=\"Foo\")\n" +"\n" +"class Foo:\n" +" def return_self(self: Self) -> Self:\n" +" ...\n" +" return self" #: ../Doc/library/typing.rst:1012 msgid "" @@ -1775,6 +2253,12 @@ msgid "" " def returns_eggs(self) -> \"Eggs\":\n" " return Eggs()" msgstr "" +"class Eggs:\n" +" # Self would be an incorrect return annotation here,\n" +" # as the object returned is always an instance of Eggs,\n" +" # even in subclasses\n" +" def returns_eggs(self) -> \"Eggs\":\n" +" return Eggs()" #: ../Doc/library/typing.rst:1035 msgid "See :pep:`673` for more details." @@ -1794,6 +2278,9 @@ msgid "" "\n" "Factors: TypeAlias = list[int]" msgstr "" +"from typing import TypeAlias\n" +"\n" +"Factors: TypeAlias = list[int]" #: ../Doc/library/typing.rst:1049 msgid "" @@ -1823,6 +2310,21 @@ msgid "" " @classmethod\n" " def make_box_of_strings(cls) -> BoxOfStrings: ..." msgstr "" +"from typing import Generic, TypeAlias, TypeVar\n" +"\n" +"T = TypeVar(\"T\")\n" +"\n" +"# \"Box\" aún no existe,\n" +"# entonces tenemos que usar comillas para la referencia adelantada en Python " +"<3.12.\n" +"# Usando ``TypeAlias`` le dice al verificador de tipos que es una " +"declaración de tipo alias,\n" +"# no una asignacin de variable a un string.\n" +"BoxOfStrings: TypeAlias = \"Box[str]\"\n" +"\n" +"class Box(Generic[T]):\n" +" @classmethod\n" +" def make_box_of_strings(cls) -> BoxOfStrings: ..." #: ../Doc/library/typing.rst:1069 msgid "See :pep:`613` for more details." @@ -1832,19 +2334,20 @@ msgstr "Ver :pep:`613` para más detalle." msgid "" ":data:`TypeAlias` is deprecated in favor of the :keyword:`type` statement, " "which creates instances of :class:`TypeAliasType` and which natively " -"supports forward references. Note that while :data:`TypeAlias` and :class:" -"`TypeAliasType` serve similar purposes and have similar names, they are " -"distinct and the latter is not the type of the former. Removal of :data:" -"`TypeAlias` is not currently planned, but users are encouraged to migrate " -"to :keyword:`type` statements." -msgstr "" -":data:`TypeAlias` ha sido descontinuado en favor de la declaración :keyword:" -"`type`, la cual crea instancias de :class:`TypeAliasType` y que admite de " -"forma nativa referencias de versiones posteriores de Python. Tenga en cuenta " -"que, si bien :data:`TypeAlias` y :class:`TypeAliasType` tienen propósitos " -"similares y tienen nombres similares, son distintos y el último no es el " -"tipo del primero. La eliminación de :data:`TypeAlias` no está prevista " -"actualmente, pero se recomienda a los usuarios que migren a las " +"supports forward references. Note that while :data:`TypeAlias` " +"and :class:`TypeAliasType` serve similar purposes and have similar names, " +"they are distinct and the latter is not the type of the former. Removal " +"of :data:`TypeAlias` is not currently planned, but users are encouraged to " +"migrate to :keyword:`type` statements." +msgstr "" +":data:`TypeAlias` ha sido descontinuado en favor de la " +"declaración :keyword:`type`, la cual crea instancias " +"de :class:`TypeAliasType` y que admite de forma nativa referencias de " +"versiones posteriores de Python. Tenga en cuenta que, si " +"bien :data:`TypeAlias` y :class:`TypeAliasType` tienen propósitos similares " +"y tienen nombres similares, son distintos y el último no es el tipo del " +"primero. La eliminación de :data:`TypeAlias` no está prevista actualmente, " +"pero se recomienda a los usuarios que migren a las " "declaraciones :keyword:`type`." #: ../Doc/library/typing.rst:1084 @@ -1884,7 +2387,7 @@ msgstr "Las uniones de uniones se simplifican (se aplanan), p. ej.::" #: ../Doc/library/typing.rst:1099 msgid "Union[Union[int, str], float] == Union[int, str, float]" -msgstr "" +msgstr "Union[Union[int, str], float] == Union[int, str, float]" #: ../Doc/library/typing.rst:1101 msgid "Unions of a single argument vanish, e.g.::" @@ -1892,7 +2395,7 @@ msgstr "Las uniones con un solo argumento se eliminan, p. ej.::" #: ../Doc/library/typing.rst:1103 msgid "Union[int] == int # The constructor actually returns int" -msgstr "" +msgstr "Union[int] == int # El constructor de hecho retorna int" #: ../Doc/library/typing.rst:1105 msgid "Redundant arguments are skipped, e.g.::" @@ -1900,7 +2403,7 @@ msgstr "Argumentos repetidos se omiten, p. ej.::" #: ../Doc/library/typing.rst:1107 msgid "Union[int, str, int] == Union[int, str] == int | str" -msgstr "" +msgstr "Union[int, str, int] == Union[int, str] == int | str" #: ../Doc/library/typing.rst:1109 msgid "When comparing unions, the argument order is ignored, e.g.::" @@ -1909,7 +2412,7 @@ msgstr "" #: ../Doc/library/typing.rst:1111 msgid "Union[int, str] == Union[str, int]" -msgstr "" +msgstr "Union[int, str] == Union[str, int]" #: ../Doc/library/typing.rst:1113 msgid "You cannot subclass or instantiate a ``Union``." @@ -1952,6 +2455,8 @@ msgid "" "def foo(arg: int = 0) -> None:\n" " ..." msgstr "" +"def foo(arg: int = 0) -> None:\n" +" ..." #: ../Doc/library/typing.rst:1136 msgid "" @@ -1967,6 +2472,8 @@ msgid "" "def foo(arg: Optional[int] = None) -> None:\n" " ..." msgstr "" +"def foo(arg: Optional[int] = None) -> None:\n" +" ..." #: ../Doc/library/typing.rst:1143 msgid "" @@ -1996,26 +2503,26 @@ msgstr "" "invocable. El uso se realiza en el formato ``Concatenate[Arg1Type, " "Arg2Type, ..., ParamSpecVariable]``. ``Concatenate`` actualmente solo es " "válido cuando se utiliza como primer argumento de un :ref:`Callable " -"`. El último parámetro de ``Concatenate`` debe ser un :" -"class:`ParamSpec` o elipsis." +"`. El último parámetro de ``Concatenate`` debe ser " +"un :class:`ParamSpec` o elipsis." #: ../Doc/library/typing.rst:1160 msgid "" -"For example, to annotate a decorator ``with_lock`` which provides a :class:" -"`threading.Lock` to the decorated function, ``Concatenate`` can be used to " -"indicate that ``with_lock`` expects a callable which takes in a ``Lock`` as " -"the first argument, and returns a callable with a different type signature. " -"In this case, the :class:`ParamSpec` indicates that the returned callable's " -"parameter types are dependent on the parameter types of the callable being " -"passed in::" -msgstr "" -"Por ejemplo, para anotar un decorador ``with_lock`` que proporciona un :" -"class:`threading.Lock` a la función decorada, ``Concatenate`` puede usarse " -"para indicar que ``with_lock`` espera un invocable que toma un ``Lock`` como " -"primer argumento y retorna un invocable con un tipo de firma diferente. En " -"este caso, el :class:`ParamSpec` indica que los tipos de parámetros de los " -"invocables retornados dependen de los tipos de parámetros de los invocables " -"que se pasan en ::" +"For example, to annotate a decorator ``with_lock`` which provides " +"a :class:`threading.Lock` to the decorated function, ``Concatenate`` can be " +"used to indicate that ``with_lock`` expects a callable which takes in a " +"``Lock`` as the first argument, and returns a callable with a different type " +"signature. In this case, the :class:`ParamSpec` indicates that the returned " +"callable's parameter types are dependent on the parameter types of the " +"callable being passed in::" +msgstr "" +"Por ejemplo, para anotar un decorador ``with_lock`` que proporciona " +"un :class:`threading.Lock` a la función decorada, ``Concatenate`` puede " +"usarse para indicar que ``with_lock`` espera un invocable que toma un " +"``Lock`` como primer argumento y retorna un invocable con un tipo de firma " +"diferente. En este caso, el :class:`ParamSpec` indica que los tipos de " +"parámetros de los invocables retornados dependen de los tipos de parámetros " +"de los invocables que se pasan en ::" #: ../Doc/library/typing.rst:1168 msgid "" @@ -2044,6 +2551,32 @@ msgid "" "# We don't need to pass in the lock ourselves thanks to the decorator.\n" "sum_threadsafe([1.1, 2.2, 3.3])" msgstr "" +"from collections.abc import Callable\n" +"from threading import Lock\n" +"from typing import Concatenate\n" +"\n" +"# Utilice este bloqueo para garantizar que solo un hilo esté ejecutando una " +"función\n" +"# en cualquier momento.\n" +"my_lock = Lock()\n" +"\n" +"def with_lock[**P, R](f: Callable[Concatenate[Lock, P], R]) -> Callable[P, " +"R]:\n" +" '''A type-safe decorator which provides a lock.'''\n" +" def inner(*args: P.args, **kwargs: P.kwargs) -> R:\n" +" # Proporcione el bloqueo como primer argumento.\n" +" return f(my_lock, *args, **kwargs)\n" +" return inner\n" +"\n" +"@with_lock\n" +"def sum_threadsafe(lock: Lock, numbers: list[float]) -> float:\n" +" '''Add a list of numbers together in a thread-safe manner.'''\n" +" with lock:\n" +" return sum(numbers)\n" +"\n" +"# No necesitamos pasar por la cerradura nosotros mismos gracias al " +"decorador.\n" +"sum_threadsafe([1.1, 2.2, 3.3])" #: ../Doc/library/typing.rst:1196 ../Doc/library/typing.rst:2127 msgid "" @@ -2086,6 +2619,15 @@ msgid "" "open_helper('/some/path', 'r') # Passes type check\n" "open_helper('/other/path', 'typo') # Error in type checker" msgstr "" +"def validate_simple(data: Any) -> Literal[True]: # siempre retorna True\n" +" ...\n" +"\n" +"type Mode = Literal['r', 'rb', 'w', 'wb']\n" +"def open_helper(file: str, mode: Mode) -> str:\n" +" ...\n" +"\n" +"open_helper('/some/path', 'r') # Pasa el verificador de tipos\n" +"open_helper('/other/path', 'typo') # Error en el verificador de tipos" #: ../Doc/library/typing.rst:1221 msgid "" @@ -2132,6 +2674,9 @@ msgid "" " stats: ClassVar[dict[str, int]] = {} # class variable\n" " damage: int = 10 # instance variable" msgstr "" +"class Starship:\n" +" stats: ClassVar[dict[str, int]] = {} # variable de clase\n" +" damage: int = 10 # variable de instancia" # subscribed se substituye por niveles de subindice #: ../Doc/library/typing.rst:1245 @@ -2141,13 +2686,14 @@ msgstr "" #: ../Doc/library/typing.rst:1247 msgid "" -":data:`ClassVar` is not a class itself, and should not be used with :func:" -"`isinstance` or :func:`issubclass`. :data:`ClassVar` does not change Python " -"runtime behavior, but it can be used by third-party type checkers. For " -"example, a type checker might flag the following code as an error::" +":data:`ClassVar` is not a class itself, and should not be used " +"with :func:`isinstance` or :func:`issubclass`. :data:`ClassVar` does not " +"change Python runtime behavior, but it can be used by third-party type " +"checkers. For example, a type checker might flag the following code as an " +"error::" msgstr "" -":data:`ClassVar` no es un clase en sí misma, y no debe ser usado con :func:" -"`isinstance` o :func:`issubclass`. :data:`ClassVar` no modifica el " +":data:`ClassVar` no es un clase en sí misma, y no debe ser usado " +"con :func:`isinstance` o :func:`issubclass`. :data:`ClassVar` no modifica el " "comportamiento de Python en tiempo de ejecución pero puede ser utilizado por " "validadores de terceros. Por ejemplo, un validador de tipos puede marcar el " "siguiente código como erróneo::" @@ -2158,10 +2704,14 @@ msgid "" "enterprise_d.stats = {} # Error, setting class variable on instance\n" "Starship.stats = {} # This is OK" msgstr "" +"enterprise_d = Starship(3000)\n" +"enterprise_d.stats = {} # Error, establece variable de clase en la " +"instancia\n" +"Starship.stats = {} # Ésto está OK" #: ../Doc/library/typing.rst:1261 msgid ":data:`ClassVar` can now be nested in :data:`Final` and vice versa." -msgstr "" +msgstr "Ahora :data:`ClassVar` se puede anidar en :data:`Final` y viceversa." #: ../Doc/library/typing.rst:1265 msgid "Special typing construct to indicate final names to type checkers." @@ -2188,18 +2738,26 @@ msgid "" "class FastConnector(Connection):\n" " TIMEOUT = 1 # Error reported by type checker" msgstr "" +"MAX_SIZE: Final = 9000\n" +"MAX_SIZE += 1 # Error reportado por un verificador de tipos\n" +"\n" +"class Connection:\n" +" TIMEOUT: Final[int] = 10\n" +"\n" +"class FastConnector(Connection):\n" +" TIMEOUT = 1 # Error reportado por un verificador de tipos" #: ../Doc/library/typing.rst:1281 ../Doc/library/typing.rst:3081 msgid "" "There is no runtime checking of these properties. See :pep:`591` for more " "details." msgstr "" -"No hay comprobación en tiempo de ejecución para estas propiedades. Véase :" -"pep:`591` para más detalles." +"No hay comprobación en tiempo de ejecución para estas propiedades. " +"Véase :pep:`591` para más detalles." #: ../Doc/library/typing.rst:1288 msgid ":data:`Final` can now be nested in :data:`ClassVar` and vice versa." -msgstr "" +msgstr "Ahora :data:`Final` se puede anidar en :data:`ClassVar` y viceversa." #: ../Doc/library/typing.rst:1292 msgid "Special typing construct to mark a :class:`TypedDict` key as required." @@ -2212,8 +2770,8 @@ msgid "" "This is mainly useful for ``total=False`` TypedDicts. See :class:`TypedDict` " "and :pep:`655` for more details." msgstr "" -"Esto es útil principalmente para TypedDicts ``total=False``. Vea :class:" -"`TypedDict` y :pep:`655` para obtener más detalles." +"Esto es útil principalmente para TypedDicts ``total=False``. " +"Vea :class:`TypedDict` y :pep:`655` para obtener más detalles." #: ../Doc/library/typing.rst:1301 msgid "" @@ -2228,13 +2786,12 @@ msgid "See :class:`TypedDict` and :pep:`655` for more details." msgstr "Véase :class:`TypedDict` y :pep:`655` para más detalle." #: ../Doc/library/typing.rst:1310 -#, fuzzy msgid "" "A special typing construct to mark an item of a :class:`TypedDict` as read-" "only." msgstr "" -"Construcción de tipado especial para marcar una clave :class:`TypedDict` " -"como requerida." +"Una construcción de tipificación especial para marcar un elemento de " +"un :class:`TypedDict` como de solo lectura." #: ../Doc/library/typing.rst:1314 msgid "" @@ -2246,16 +2803,22 @@ msgid "" " m[\"year\"] = 1999 # allowed\n" " m[\"title\"] = \"The Matrix\" # typechecker error" msgstr "" +"class Movie(TypedDict):\n" +" title: ReadOnly[str]\n" +" year: int\n" +"\n" +"def mutate_movie(m: Movie) -> None:\n" +" m[\"year\"] = 1999 # allowed\n" +" m[\"title\"] = \"The Matrix\" # error del verificador de tipos" #: ../Doc/library/typing.rst:1322 -#, fuzzy msgid "There is no runtime checking for this property." -msgstr "No hay ninguna comprobación en tiempo de ejecución de esta propiedad." +msgstr "" +"No hay ninguna comprobación en tiempo de ejecución para esta propiedad." #: ../Doc/library/typing.rst:1324 -#, fuzzy msgid "See :class:`TypedDict` and :pep:`705` for more details." -msgstr "Véase :class:`TypedDict` y :pep:`655` para más detalle." +msgstr "Vea :class:`TypedDict` y :pep:`705` para más detalle." #: ../Doc/library/typing.rst:1330 msgid "Special typing form to add context-specific metadata to an annotation." @@ -2307,18 +2870,17 @@ msgstr "" "deshabilita por completo la verificación de tipos para una función o clase." #: ../Doc/library/typing.rst:1350 -#, fuzzy msgid "" "The responsibility of how to interpret the metadata lies with the tool or " "library encountering an ``Annotated`` annotation. A tool or library " "encountering an ``Annotated`` type can scan through the metadata elements to " "determine if they are of interest (e.g., using :func:`isinstance`)." msgstr "" -"La responsabilidad de cómo interpretar los metadatos recae en la herramienta " -"o biblioteca que encuentre la anotación ``Annotated``. Una herramienta o " +"La responsabilidad de interpretar los metadatos recae en la herramienta o " +"biblioteca que encuentra una anotación ``Annotated``. Una herramienta o " "biblioteca que encuentra un tipo ``Annotated`` puede examinar los elementos " -"de metadatos para determinar si son de interés (por ejemplo, utilizando :" -"func:`isinstance`)." +"de metadatos para determinar si son de interés (por ejemplo, " +"utilizando :func:`isinstance`)." #: ../Doc/library/typing.rst:1358 msgid "" @@ -2339,6 +2901,13 @@ msgid "" "T1 = Annotated[int, ValueRange(-10, 5)]\n" "T2 = Annotated[T1, ValueRange(-20, 3)]" msgstr "" +"@dataclass\n" +"class ValueRange:\n" +" lo: int\n" +" hi: int\n" +"\n" +"T1 = Annotated[int, ValueRange(-10, 5)]\n" +"T2 = Annotated[T1, ValueRange(-20, 3)]" #: ../Doc/library/typing.rst:1371 msgid "Details of the syntax:" @@ -2364,6 +2933,11 @@ msgid "" "\n" "Annotated[int, ValueRange(3, 10), ctype(\"char\")]" msgstr "" +"@dataclass\n" +"class ctype:\n" +" kind: str\n" +"\n" +"Annotated[int, ValueRange(3, 10), ctype(\"char\")]" #: ../Doc/library/typing.rst:1384 msgid "" @@ -2397,6 +2971,9 @@ msgid "" " int, ctype(\"char\"), ValueRange(3, 10)\n" "]" msgstr "" +"assert Annotated[int, ValueRange(3, 10), ctype(\"char\")] != Annotated[\n" +" int, ctype(\"char\"), ValueRange(3, 10)\n" +"]" #: ../Doc/library/typing.rst:1398 msgid "" @@ -2413,6 +2990,10 @@ msgid "" " int, ValueRange(3, 10), ctype(\"char\")\n" "]" msgstr "" +"assert Annotated[Annotated[int, ValueRange(3, 10)], ctype(\"char\")] == " +"Annotated[\n" +" int, ValueRange(3, 10), ctype(\"char\")\n" +"]" #: ../Doc/library/typing.rst:1405 msgid "Duplicated metadata elements are not removed::" @@ -2424,6 +3005,9 @@ msgid "" " int, ValueRange(3, 10), ValueRange(3, 10)\n" "]" msgstr "" +"assert Annotated[int, ValueRange(3, 10)] != Annotated[\n" +" int, ValueRange(3, 10), ValueRange(3, 10)\n" +"]" #: ../Doc/library/typing.rst:1411 msgid "``Annotated`` can be used with nested and generic aliases:" @@ -2442,6 +3026,16 @@ msgid "" "# ``Annotated[list[tuple[int, int]], MaxLen(10)]``:\n" "type V = Vec[int]" msgstr "" +"@dataclass\n" +"class MaxLen:\n" +" value: int\n" +"\n" +"type Vec[T] = Annotated[list[tuple[T, T]], MaxLen(10)]\n" +"\n" +"# Cuando se utiliza en una anotación de tipo, un verificador de tipo tratará " +"\"V\" de la misma manera que\n" +"# ``Annotated[list[tuple[int, int]], MaxLen(10)]``:\n" +"type V = Vec[int]" #: ../Doc/library/typing.rst:1425 msgid "``Annotated`` cannot be used with an unpacked :class:`TypeVarTuple`::" @@ -2450,8 +3044,8 @@ msgstr "" "descomprimido::" #: ../Doc/library/typing.rst:1427 -msgid "type Variadic[*Ts] = Annotated[*Ts, Ann1] # NOT valid" -msgstr "" +msgid "type Variadic[\*Ts] = Annotated[\*Ts, Ann1] # NOT valid" +msgstr "type Variadic[\*Ts] = Annotated[\*Ts, Ann1] # NO válido" #: ../Doc/library/typing.rst:1429 msgid "This would be equivalent to::" @@ -2459,7 +3053,7 @@ msgstr "Esto sería equivalente a:" #: ../Doc/library/typing.rst:1431 msgid "Annotated[T1, T2, T3, ..., Ann1]" -msgstr "" +msgstr "Annotated[T1, T2, T3, ..., Ann1]" #: ../Doc/library/typing.rst:1433 msgid "" @@ -2487,6 +3081,13 @@ msgid "" ">>> get_type_hints(func, include_extras=True)\n" "{'x': typing.Annotated[int, 'metadata'], 'return': }" msgstr "" +">>> from typing import Annotated, get_type_hints\n" +">>> def func(x: Annotated[int, \"metadata\"]) -> None: pass\n" +"...\n" +">>> get_type_hints(func)\n" +"{'x': , 'return': }\n" +">>> get_type_hints(func, include_extras=True)\n" +"{'x': typing.Annotated[int, 'metadata'], 'return': }" #: ../Doc/library/typing.rst:1449 msgid "" @@ -2505,12 +3106,20 @@ msgid "" ">>> X.__metadata__\n" "('very', 'important', 'metadata')" msgstr "" +">>> from typing import Annotated\n" +">>> X = Annotated[int, \"very\", \"important\", \"metadata\"]\n" +">>> X\n" +"typing.Annotated[int, 'very', 'important', 'metadata']\n" +">>> X.__metadata__\n" +"('very', 'important', 'metadata')" #: ../Doc/library/typing.rst:1461 msgid "" "At runtime, if you want to retrieve the original type wrapped by " "``Annotated``, use the :attr:`!__origin__` attribute:" msgstr "" +"En tiempo de ejecución, si desea recuperar el tipo original envuelto por " +"``Annotated``, utilice el atributo :attr:`!__origin__`:" #: ../Doc/library/typing.rst:1464 msgid "" @@ -2519,16 +3128,24 @@ msgid "" ">>> Password.__origin__\n" "" msgstr "" +">>> from typing import Annotated, get_origin\n" +">>> Password = Annotated[str, \"secret\"]\n" +">>> Password.__origin__\n" +"" #: ../Doc/library/typing.rst:1471 msgid "Note that using :func:`get_origin` will return ``Annotated`` itself:" msgstr "" +"Tenga en cuenta que el uso de :func:`get_origin` devolverá el mismo " +"``Annotated``:" #: ../Doc/library/typing.rst:1473 msgid "" ">>> get_origin(Password)\n" "typing.Annotated" msgstr "" +">>> get_origin(Password)\n" +"typing.Annotated" #: ../Doc/library/typing.rst:1480 msgid ":pep:`593` - Flexible function and variable annotations" @@ -2539,28 +3156,26 @@ msgid "The PEP introducing ``Annotated`` to the standard library." msgstr "El PEP introduce ``Annotated`` en la biblioteca estándar." #: ../Doc/library/typing.rst:1488 ../Doc/library/typing.rst:1572 -#, fuzzy msgid "" "Special typing construct for marking user-defined type predicate functions." msgstr "" -"Construcción de tipado especial para marcar funciones de protección de tipo " -"definidas por el usuario." +"Construcción de tipificación especial para marcar funciones de predicado de " +"tipo definido por el usuario." #: ../Doc/library/typing.rst:1490 -#, fuzzy msgid "" "``TypeIs`` can be used to annotate the return type of a user-defined type " "predicate function. ``TypeIs`` only accepts a single type argument. At " "runtime, functions marked this way should return a boolean and take at least " "one positional argument." msgstr "" -"``TypeGuard`` se puede utilizar para anotar el tipo de retorno de una " -"función de protección de tipo definida por el usuario. ``TypeGuard`` solo " -"acepta un único argumento de tipo. En tiempo de ejecución, las funciones " -"marcadas de esta manera deben devolver un valor booleano." +"``TypeIs`` se puede utilizar para anotar el tipo de retorno de una función " +"de predicado de tipo definida por el usuario. ``TypeIs`` solo acepta un " +"único argumento de tipo. En tiempo de ejecución, las funciones marcadas de " +"esta manera deben devolver un valor booleano y tomar al menos un argumento " +"posicional." #: ../Doc/library/typing.rst:1495 -#, fuzzy msgid "" "``TypeIs`` aims to benefit *type narrowing* -- a technique used by static " "type checkers to determine a more precise type of an expression within a " @@ -2569,12 +3184,12 @@ msgid "" "conditional expression here is sometimes referred to as a \"type " "predicate\"::" msgstr "" -"``TypeGuard`` tiene como objetivo beneficiar a *type narrowing*, una técnica " -"utilizada por los validadores de tipo estático para determinar un tipo más " -"preciso de una expresión dentro del flujo de código de un programa. Por lo " -"general, el estrechamiento de tipos se realiza analizando el flujo de código " -"condicional y aplicando el estrechamiento a un bloque de código. La " -"expresión condicional aquí a veces se denomina \"protección de tipo\":" +"``TypeIs`` tiene como objetivo beneficiar a *type narrowing*, una técnica " +"utilizada por los verificadores de tipos estáticos para determinar un tipo " +"más preciso de una expresión dentro del flujo de código de un programa. Por " +"lo general, la restricción de tipos se realiza analizando el flujo de código " +"condicional y aplicando la restricción a un bloque de código. La expresión " +"condicional aquí a veces se denomina \"predicado de tipo\":" #: ../Doc/library/typing.rst:1501 msgid "" @@ -2587,48 +3202,61 @@ msgid "" " # Else, type of ``val`` is narrowed to ``float``.\n" " ..." msgstr "" +"def is_str(val: str | float):\n" +" # \"isinstance\" predicado de tipo\n" +" if isinstance(val, str):\n" +" # Tipo de ``val`` se reduce a ``str``\n" +" ...\n" +" else:\n" +" # De lo contrario, el tipo de ``val`` se limita a ``float``.\n" +" ..." #: ../Doc/library/typing.rst:1510 msgid "" "Sometimes it would be convenient to use a user-defined boolean function as a " -"type predicate. Such a function should use ``TypeIs[...]`` or :data:" -"`TypeGuard` as its return type to alert static type checkers to this " -"intention. ``TypeIs`` usually has more intuitive behavior than " +"type predicate. Such a function should use ``TypeIs[...]`` " +"or :data:`TypeGuard` as its return type to alert static type checkers to " +"this intention. ``TypeIs`` usually has more intuitive behavior than " "``TypeGuard``, but it cannot be used when the input and output types are " "incompatible (e.g., ``list[object]`` to ``list[int]``) or when the function " "does not return ``True`` for all instances of the narrowed type." msgstr "" +"A veces sería conveniente utilizar una función booleana definida por el " +"usuario como predicado de tipo. Dicha función debería utilizar " +"``TypeIs[...]`` o :data:`TypeGuard` como su tipo de retorno para alertar a " +"los verificadores de tipos estáticos sobre esta intención. ``TypeIs`` suele " +"tener un comportamiento más intuitivo que ``TypeGuard``, pero no se puede " +"utilizar cuando los tipos de entrada y salida son incompatibles (por " +"ejemplo, ``list[object]`` a ``list[int]``) o cuando la función no devuelve " +"``True`` para todas las instancias del tipo restringido." #: ../Doc/library/typing.rst:1518 -#, fuzzy msgid "" "Using ``-> TypeIs[NarrowedType]`` tells the static type checker that for a " "given function:" msgstr "" -"El uso de ``-> TypeGuard`` le dice al validador de tipo estático que para " -"una función determinada:" +"El uso de ``-> TypeIs[NarrowedType]`` le indica al verificador de tipo " +"estático que para una función determinada:" #: ../Doc/library/typing.rst:1521 ../Doc/library/typing.rst:1582 msgid "The return value is a boolean." msgstr "El valor de retorno es un booleano." #: ../Doc/library/typing.rst:1522 -#, fuzzy msgid "" "If the return value is ``True``, the type of its argument is the " "intersection of the argument's original type and ``NarrowedType``." msgstr "" -"Si el valor de retorno es ``True``, el tipo de su argumento es el tipo " -"dentro de ``TypeGuard``." +"Si el valor de retorno es ``True``, el tipo de su argumento es la " +"intersección del tipo original del argumento y ``NarrowedType``." #: ../Doc/library/typing.rst:1524 -#, fuzzy msgid "" "If the return value is ``False``, the type of its argument is narrowed to " "exclude ``NarrowedType``." msgstr "" -"Si el valor de retorno es ``True``, el tipo de su argumento es el tipo " -"dentro de ``TypeGuard``." +"Si el valor de retorno es ``False``, el tipo de su argumento se limita para " +"excluir ``NarrowedType``." #: ../Doc/library/typing.rst:1529 msgid "" @@ -2653,6 +3281,26 @@ msgid "" " # so only ``Unrelated`` is left.\n" " assert_type(arg, Unrelated)" msgstr "" +"from typing import assert_type, final, TypeIs\n" +"\n" +"class Parent: pass\n" +"class Child(Parent): pass\n" +"@final\n" +"class Unrelated: pass\n" +"\n" +"def is_parent(val: object) -> TypeIs[Parent]:\n" +" return isinstance(val, Parent)\n" +"\n" +"def run(arg: Child | Unrelated):\n" +" if is_parent(arg):\n" +" # El tipo de ``arg`` es reducido a la intersección\n" +" # de ``Parent`` y ``Child``, lo cual es equivalente a\n" +" # ``Child``.\n" +" assert_type(arg, Child)\n" +" else:\n" +" # El tipo de ``arg`` es reducido para excluir ``Parent``,\n" +" # para que solo quede ``Unrelated``.\n" +" assert_type(arg, Unrelated)" #: ../Doc/library/typing.rst:1550 msgid "" @@ -2662,37 +3310,40 @@ msgid "" "behavior in the type system; it is the user's responsibility to write such " "functions in a type-safe manner." msgstr "" +"El tipo dentro de ``TypeIs`` debe ser coherente con el tipo del argumento de " +"la función; si no lo es, los comprobadores de tipos estáticos generarán un " +"error. Una función ``TypeIs`` escrita incorrectamente puede provocar un " +"comportamiento incorrecto en el sistema de tipos; es responsabilidad del " +"usuario escribir dichas funciones de manera segura." #: ../Doc/library/typing.rst:1556 -#, fuzzy msgid "" "If a ``TypeIs`` function is a class or instance method, then the type in " "``TypeIs`` maps to the type of the second parameter (after ``cls`` or " "``self``)." msgstr "" -"Si ``is_str_list`` es un método de clase o instancia, entonces el tipo en " -"``TypeGuard`` se asigna al tipo del segundo parámetro después de ``cls`` o " -"``self``." +"Si una función ``TypeIs`` es un método de clase o instancia, entonces el " +"tipo en ``TypeIs`` se asigna al tipo del segundo parámetro (después de " +"``cls`` o ``self``)." #: ../Doc/library/typing.rst:1560 -#, fuzzy msgid "" "In short, the form ``def foo(arg: TypeA) -> TypeIs[TypeB]: ...``, means that " "if ``foo(arg)`` returns ``True``, then ``arg`` is an instance of ``TypeB``, " "and if it returns ``False``, it is not an instance of ``TypeB``." msgstr "" -"En resumen, la forma ``def foo(arg: TypeA) -> TypeGuard[TypeB]: ...`` " -"significa que si ``foo(arg)`` retorna ``True``, entonces ``arg`` se estrecha " -"de ``TypeA`` a ``TypeB``." +"En resumen, la forma ``def foo(arg: TypeA) -> TypeIs[TypeB]: ...``, " +"significa que si ``foo(arg)`` devuelve ``True``, entonces ``arg`` es una " +"instancia de ``TypeB``, y si devuelve ``False``, no es una instancia de " +"``TypeB``." #: ../Doc/library/typing.rst:1564 -#, fuzzy msgid "" -"``TypeIs`` also works with type variables. For more information, see :pep:" -"`742` (Narrowing types with ``TypeIs``)." +"``TypeIs`` also works with type variables. For more information, " +"see :pep:`742` (Narrowing types with ``TypeIs``)." msgstr "" -"``TypeGuard`` también funciona con variables de tipo. Véase :pep:`647` para " -"más detalles." +"``TypeIs`` también funciona con variables de tipo. Para obtener más " +"información, consulte :pep:`742` (Restringir tipos con ``TypeIs``)." #: ../Doc/library/typing.rst:1574 msgid "" @@ -2701,6 +3352,11 @@ msgid "" "similarly to :data:`TypeIs`, but has subtly different effects on type " "checking behavior (see below)." msgstr "" +"Las funciones de predicado de tipo son funciones definidas por el usuario " +"que indican si su argumento es una instancia de un tipo en particular. " +"``TypeGuard`` funciona de manera similar a :data:`TypeIs`, pero tiene " +"efectos ligeramente diferentes en el comportamiento de verificación de tipo " +"(ver a continuación)." #: ../Doc/library/typing.rst:1579 msgid "" @@ -2740,24 +3396,33 @@ msgid "" " # Type of ``val`` remains as ``list[object]``.\n" " print(\"Not a list of strings!\")" msgstr "" +"def is_str_list(val: list[object]) -> TypeGuard[list[str]]:\n" +" '''Determines whether all objects in the list are strings'''\n" +" return all(isinstance(x, str) for x in val)\n" +"\n" +"def func1(val: list[object]):\n" +" if is_str_list(val):\n" +" # El tipo de ``val`` es reducido a ``list[str]``.\n" +" print(\" \".join(val))\n" +" else:\n" +" # El tipo de ``val`` se mantiene como ``list[object]``.\n" +" print(\"Not a list of strings!\")" #: ../Doc/library/typing.rst:1602 msgid "``TypeIs`` and ``TypeGuard`` differ in the following ways:" -msgstr "" +msgstr "``TypeIs`` y ``TypeGuard`` se diferencian en los siguientes aspectos:" #: ../Doc/library/typing.rst:1604 -#, fuzzy msgid "" "``TypeIs`` requires the narrowed type to be a subtype of the input type, " "while ``TypeGuard`` does not. The main reason is to allow for things like " "narrowing ``list[object]`` to ``list[str]`` even though the latter is not a " "subtype of the former, since ``list`` is invariant." msgstr "" -"No es necesario que ``TypeB`` sea una forma más estrecha de ``TypeA``; " -"incluso puede ser una forma más amplia. La razón principal es permitir cosas " -"como reducir ``List[object]`` a ``List[str]`` aunque este último no sea un " -"subtipo del primero, ya que ``List`` es invariante. La responsabilidad de " -"escribir protecciones de tipo seguras se deja al usuario." +"``TypeIs`` requiere que el tipo restringido sea un subtipo del tipo de " +"entrada, mientras que ``TypeGuard`` no lo requiere. La razón principal es " +"permitir cosas como restringir ``list[object]`` a ``list[str]``, aunque este " +"último no sea un subtipo del primero, ya que ``list`` es invariante." #: ../Doc/library/typing.rst:1608 msgid "" @@ -2767,6 +3432,12 @@ msgid "" "combining the previously known type of the variable with the ``TypeIs`` " "type. (Technically, this is known as an intersection type.)" msgstr "" +"Cuando una función ``TypeGuard`` devuelve ``True``, los verificadores de " +"tipo limitan el tipo de la variable exactamente al tipo ``TypeGuard``. " +"Cuando una función ``TypeIs`` devuelve ``True``, los verificadores de tipo " +"pueden inferir un tipo más preciso combinando el tipo conocido previamente " +"de la variable con el tipo ``TypeIs``. (Técnicamente, esto se conoce como un " +"tipo de intersección)." #: ../Doc/library/typing.rst:1612 msgid "" @@ -2775,6 +3446,10 @@ msgid "" "``False``, type checkers can narrow the type of the variable to exclude the " "``TypeIs`` type." msgstr "" +"Cuando una función ``TypeGuard`` devuelve ``False``, los verificadores de " +"tipo no pueden limitar el tipo de la variable en absoluto. Cuando una " +"función ``TypeIs`` devuelve ``False``, los verificadores de tipo pueden " +"limitar el tipo de la variable para excluir el tipo ``TypeIs``." #: ../Doc/library/typing.rst:1621 msgid "Typing operator to conceptually mark an object as having been unpacked." @@ -2783,15 +3458,14 @@ msgstr "" "desempaquetado." #: ../Doc/library/typing.rst:1623 -#, fuzzy msgid "" "For example, using the unpack operator ``*`` on a :ref:`type variable tuple " "` is equivalent to using ``Unpack`` to mark the type variable " "tuple as having been unpacked::" msgstr "" -"Por ejemplo, usar el operador de desempaquetamiento ``*`` en una :class:" -"`tupla de variable de tipo ` es equivalente a usar ``Unpack`` " -"para marcar la tupla de variable de tipo como desempaquetada::" +"Por ejemplo, usar el operador de descompresión ``*`` en un :ref:`type " +"variable tuple ` es equivalente a usar ``Unpack`` para marcar " +"la tupla de variable de tipo como descomprimida:" #: ../Doc/library/typing.rst:1627 msgid "" @@ -2800,6 +3474,10 @@ msgid "" "# Effectively does:\n" "tup: tuple[Unpack[Ts]]" msgstr "" +"Ts = TypeVarTuple('Ts')\n" +"tup: tuple[*Ts]\n" +"# Effectively does:\n" +"tup: tuple[Unpack[Ts]]" #: ../Doc/library/typing.rst:1632 msgid "" @@ -2809,10 +3487,10 @@ msgid "" "versions of Python, where ``*`` couldn't be used in certain places::" msgstr "" "De hecho, ``Unpack`` se puede usar indistintamente con ``*`` en el contexto " -"de los tipos :class:`typing.TypeVarTuple ` y :class:`builtins." -"tuple `. Es posible que veas que ``Unpack`` se usa explícitamente en " -"versiones anteriores de Python, donde ``*`` no se podía usar en ciertos " -"lugares::" +"de los tipos :class:`typing.TypeVarTuple ` " +"y :class:`builtins.tuple `. Es posible que veas que ``Unpack`` se usa " +"explícitamente en versiones anteriores de Python, donde ``*`` no se podía " +"usar en ciertos lugares::" #: ../Doc/library/typing.rst:1638 msgid "" @@ -2824,6 +3502,14 @@ msgid "" "tup: tuple[*Ts] # Syntax error on Python <= 3.10!\n" "tup: tuple[Unpack[Ts]] # Semantically equivalent, and backwards-compatible" msgstr "" +"# En versiones anteriores de Python, TypeVarTuple y Unpack\n" +"# se encuentran en el paquete de retroadaptación `typing_extensions`.\n" +"from typing_extensions import TypeVarTuple, Unpack\n" +"\n" +"Ts = TypeVarTuple('Ts')\n" +"tup: tuple[*Ts] # Error de sintaxis en Python <= 3.10!\n" +"tup: tuple[Unpack[Ts]] # Equivalente semánticamente, y compatible con " +"versiones anteriores" #: ../Doc/library/typing.rst:1646 msgid "" @@ -2845,6 +3531,16 @@ msgid "" "# and `year` of type `int`.\n" "def foo(**kwargs: Unpack[Movie]): ..." msgstr "" +"from typing import TypedDict, Unpack\n" +"\n" +"class Movie(TypedDict):\n" +" name: str\n" +" year: int\n" +"\n" +"# Esta función espera dos argumentos de palabras clave: `name` de tipo " +"`str`\n" +"# y `year` de tipo `int`.\n" +"def foo(**kwargs: Unpack[Movie]): ..." #: ../Doc/library/typing.rst:1659 msgid "" @@ -2898,6 +3594,10 @@ msgid "" " ...\n" " # Etc." msgstr "" +"class Mapping[KT, VT]:\n" +" def __getitem__(self, key: KT) -> VT:\n" +" ...\n" +" # Etc." #: ../Doc/library/typing.rst:1687 msgid "" @@ -2920,14 +3620,19 @@ msgid "" " except KeyError:\n" " return default" msgstr "" +"def lookup_name[X, Y](mapping: Mapping[X, Y], key: X, default: Y) -> Y:\n" +" try:\n" +" return mapping[key]\n" +" except KeyError:\n" +" return default" #: ../Doc/library/typing.rst:1699 msgid "" "Here the brackets after the function name indicate a :ref:`generic function " "`." msgstr "" -"Aquí los corchetes después del nombre de la función indican una :ref:" -"`función genérica `." +"Aquí los corchetes después del nombre de la función indican " +"una :ref:`función genérica `." #: ../Doc/library/typing.rst:1702 msgid "" @@ -2949,6 +3654,13 @@ msgid "" " ...\n" " # Etc." msgstr "" +"KT = TypeVar('KT')\n" +"VT = TypeVar('VT')\n" +"\n" +"class Mapping(Generic[KT, VT]):\n" +" def __getitem__(self, key: KT) -> VT:\n" +" ...\n" +" # Etc." #: ../Doc/library/typing.rst:1719 msgid "Type variable." @@ -2961,15 +3673,17 @@ msgid "" "`, and :ref:`generic type aliases `::" msgstr "" "La forma preferida de construir una variable de tipo es a través de la " -"sintaxis dedicada para :ref:`funciones genéricas `, :ref:" -"`clases genéricas ` y :ref:`alias de tipo genérico `::" +"sintaxis dedicada para :ref:`funciones genéricas `, :ref:`clases genéricas ` y :ref:`alias de tipo " +"genérico `::" #: ../Doc/library/typing.rst:1726 msgid "" "class Sequence[T]: # T is a TypeVar\n" " ..." msgstr "" +"class Sequence[T]: # T is a TypeVar\n" +" ..." #: ../Doc/library/typing.rst:1729 msgid "" @@ -2988,6 +3702,13 @@ msgid "" "str or bytes\n" " ..." msgstr "" +"class StrSequence[S: str]: # S es un TypeVar ligado a str\n" +" ...\n" +"\n" +"\n" +"class StrOrBytesSequence[A: (str, bytes)]: # A es un TypeVar limitado a str " +"o bytes\n" +" ..." #: ../Doc/library/typing.rst:1739 msgid "" @@ -3003,6 +3724,9 @@ msgid "" "S = TypeVar('S', bound=str) # Can be any subtype of str\n" "A = TypeVar('A', str, bytes) # Must be exactly str or bytes" msgstr "" +"T = TypeVar('T') # Puede ser cualquier cosa\n" +"S = TypeVar('S', bound=str) # Puede ser cualquier subtipo de str\n" +"A = TypeVar('A', str, bytes) # Tiene que ser exactamente str o bytes" #: ../Doc/library/typing.rst:1745 msgid "" @@ -3013,9 +3737,9 @@ msgid "" msgstr "" "Las variables de tipo existen principalmente para el beneficio de los " "validadores de tipos estáticos. Sirven como parámetros para tipos genéricos, " -"así como para definiciones de alias de tipo y funciones genéricas. Consulte :" -"class:`Generic` para obtener más información sobre tipos genéricos. Las " -"funciones genéricas funcionan de la siguiente manera::" +"así como para definiciones de alias de tipo y funciones genéricas. " +"Consulte :class:`Generic` para obtener más información sobre tipos " +"genéricos. Las funciones genéricas funcionan de la siguiente manera::" #: ../Doc/library/typing.rst:1751 msgid "" @@ -3034,6 +3758,20 @@ msgid "" " \"\"\"Add two strings or bytes objects together.\"\"\"\n" " return x + y" msgstr "" +"def repeat[T](x: T, n: int) -> Sequence[T]:\n" +" \"\"\"Return a list containing n references to x.\"\"\"\n" +" return [x]*n\n" +"\n" +"\n" +"def print_capitalized[S: str](x: S) -> S:\n" +" \"\"\"Print x capitalized, and return x.\"\"\"\n" +" print(x.capitalize())\n" +" return x\n" +"\n" +"\n" +"def concatenate[A: (str, bytes)](x: A, y: A) -> A:\n" +" \"\"\"Add two strings or bytes objects together.\"\"\"\n" +" return x + y" #: ../Doc/library/typing.rst:1766 msgid "" @@ -3085,6 +3823,16 @@ msgid "" "\n" "z = print_capitalized(45) # error: int is not a subtype of str" msgstr "" +"x = print_capitalized('a string')\n" +"reveal_type(x) # el tipo revelado es str\n" +"\n" +"class StringSubclass(str):\n" +" pass\n" +"\n" +"y = print_capitalized(StringSubclass('another string'))\n" +"reveal_type(y) # revealed type is StringSubclass\n" +"\n" +"z = print_capitalized(45) # error: int no es un subtipo de str" #: ../Doc/library/typing.rst:1792 msgid "" @@ -3104,6 +3852,14 @@ msgid "" "bytes\n" "V = TypeVar('V', bound=SupportsAbs) # Can be anything with an __abs__ method" msgstr "" +"# Puede ser cualquier cosa con un método __abs__\n" +"def print_abs[T: SupportsAbs](arg: T) -> None:\n" +" print(\"Absolute value:\", abs(arg))\n" +"\n" +"U = TypeVar('U', bound=str|bytes) # Puede ser cualquier subtipo de la unión " +"str|bytes\n" +"V = TypeVar('V', bound=SupportsAbs) # Puede ser cualquier cosa con un " +"método __abs__" #: ../Doc/library/typing.rst:1804 msgid "" @@ -3126,6 +3882,14 @@ msgid "" "c = concatenate('one', b'two') # error: type variable 'A' can be either str " "or bytes in a function call, but not both" msgstr "" +"a = concatenate('one', 'two')\n" +"reveal_type(a) # tipo revelado es str\n" +"\n" +"b = concatenate(StringSubclass('one'), StringSubclass('two'))\n" +"reveal_type(b) # tipo revelado es str, a pesar que se pasa StringSubclass\n" +"\n" +"c = concatenate('one', b'two') # error: la variable de tipo 'A' puede ser " +"str o bytes en una llamada a función, pero no ambas" #: ../Doc/library/typing.rst:1815 msgid "At runtime, ``isinstance(x, T)`` will raise :exc:`TypeError`." @@ -3177,22 +3941,28 @@ msgid "" msgstr "" "Para las variables de tipo creadas a través de la :ref:`sintáxis de " "parámetros de tipo `, las restricciones se evalúan solo cuando " -"se accede al atributo, no cuando se crea la variable de tipo (consulte :ref:" -"`lazy-evaluation`)." +"se accede al atributo, no cuando se crea la variable de tipo " +"(consulte :ref:`lazy-evaluation`)." #: ../Doc/library/typing.rst:1857 msgid "" "The default value of the type variable, or :data:`typing.NoDefault` if it " "has no default." msgstr "" +"El valor predeterminado de la variable de tipo, o :data:`typing.NoDefault` " +"si no tiene valor predeterminado." #: ../Doc/library/typing.rst:1864 msgid "" "Return whether or not the type variable has a default value. This is " -"equivalent to checking whether :attr:`__default__` is not the :data:`typing." -"NoDefault` singleton, except that it does not force evaluation of the :ref:" -"`lazily evaluated ` default value." +"equivalent to checking whether :attr:`__default__` is not " +"the :data:`typing.NoDefault` singleton, except that it does not force " +"evaluation of the :ref:`lazily evaluated ` default value." msgstr "" +"Devuelve si la variable de tipo tiene o no un valor predeterminado. Esto es " +"equivalente a verificar si :attr:`__default__` no es el " +"singleton :data:`typing.NoDefault`, excepto que no fuerza la evaluación del " +"valor predeterminado :ref:`lazily evaluated `." #: ../Doc/library/typing.rst:1873 msgid "" @@ -3200,24 +3970,22 @@ msgid "" "params>` syntax introduced by :pep:`695`. The ``infer_variance`` parameter " "was added." msgstr "" -"Ahora es posible declarar variables de tipo utilizando la sintaxis de :ref:" -"`parámetros de tipo ` introducida por :pep:`695`. Se agregó el " -"parámetro ``infer_variance``." +"Ahora es posible declarar variables de tipo utilizando la sintaxis " +"de :ref:`parámetros de tipo ` introducida por :pep:`695`. Se " +"agregó el parámetro ``infer_variance``." #: ../Doc/library/typing.rst:1879 ../Doc/library/typing.rst:2018 #: ../Doc/library/typing.rst:2120 -#, fuzzy msgid "Support for default values was added." -msgstr "Soporte añadido para valores por defecto, métodos y *docstrings*." +msgstr "Se agregó soporte para valores predeterminados." #: ../Doc/library/typing.rst:1885 -#, fuzzy msgid "" "Type variable tuple. A specialized form of :ref:`type variable ` " "that enables *variadic* generics." msgstr "" -"Tupla de variables de tipo. Una versión especializada de :class:`type " -"variables ` que permite genéricos *variádicos*." +"Tupla de variable de tipo. Forma especializada de :ref:`type variable " +"` que habilita genéricos de *variadic*." #: ../Doc/library/typing.rst:1888 msgid "" @@ -3234,6 +4002,9 @@ msgid "" "T]:\n" " return (*tup[1:], tup[0])" msgstr "" +"def move_first_element_to_last[T, *Ts](tup: tuple[T, *Ts]) -> tuple[*Ts, " +"T]:\n" +" return (*tup[1:], tup[0])" #: ../Doc/library/typing.rst:1894 msgid "Or by explicitly invoking the ``TypeVarTuple`` constructor::" @@ -3247,6 +4018,11 @@ msgid "" "def move_first_element_to_last(tup: tuple[T, *Ts]) -> tuple[*Ts, T]:\n" " return (*tup[1:], tup[0])" msgstr "" +"T = TypeVar(\"T\")\n" +"Ts = TypeVarTuple(\"Ts\")\n" +"\n" +"def move_first_element_to_last(tup: tuple[T, *Ts]) -> tuple[*Ts, T]:\n" +" return (*tup[1:], tup[0])" #: ../Doc/library/typing.rst:1902 msgid "" @@ -3279,6 +4055,23 @@ msgid "" "# (at least one element is required)\n" "move_first_element_to_last(tup=())" msgstr "" +"# T está ligado a int, Ts está ligado a ()\n" +"# El valor de retorno es (1,), que tiene tipo tuple[int]\n" +"move_first_element_to_last(tup=(1,))\n" +"\n" +"# T está ligado a int, Ts está ligado a (str,)\n" +"# El valor de retorno es ('spam', 1), que tiene tipo tuple[str, int]\n" +"move_first_element_to_last(tup=(1, 'spam'))\n" +"\n" +"# T está ligado a int, Ts está ligado a (str, float)\n" +"# El valor de retorno es ('spam', 3.0, 1), que tiene tipo tuple[str, float, " +"int]\n" +"move_first_element_to_last(tup=(1, 'spam', 3.0))\n" +"\n" +"# Esto falla al verificar el tipo (y falla en tiempo de ejecución)\n" +"# porque tuple[()] no es compatible con tuple[T, *Ts]\n" +"# (se requiere al menos un elemento)\n" +"move_first_element_to_last(tup=())" #: ../Doc/library/typing.rst:1924 msgid "" @@ -3311,6 +4104,9 @@ msgid "" "x: tuple[Ts] # Not valid\n" "x: tuple[*Ts] # The correct way to do it" msgstr "" +"x: Ts # No válido\n" +"x: tuple[Ts] # No válido\n" +"x: tuple[*Ts] # La forma correcta de hacerlo" #: ../Doc/library/typing.rst:1939 msgid "" @@ -3328,6 +4124,10 @@ msgid "" " def __abs__(self) -> \"Array[*Shape]\": ...\n" " def get_shape(self) -> tuple[*Shape]: ..." msgstr "" +"class Array[*Shape]:\n" +" def __getitem__(self, key: tuple[*Shape]) -> float: ...\n" +" def __abs__(self) -> \"Array[*Shape]\": ...\n" +" def get_shape(self) -> tuple[*Shape]: ..." #: ../Doc/library/typing.rst:1947 msgid "" @@ -3350,6 +4150,17 @@ msgid "" "float_array_1d: Array[float, Height] = Array() # Totally fine\n" "int_array_2d: Array[int, Height, Width] = Array() # Yup, fine too" msgstr "" +"class Array[DType, *Shape]: # Esto está bien\n" +" pass\n" +"\n" +"class Array2[*Shape, DType]: # Esto también está bien\n" +" pass\n" +"\n" +"class Height: ...\n" +"class Width: ...\n" +"\n" +"float_array_1d: Array[float, Height] = Array() # Totalmente bien\n" +"int_array_2d: Array[int, Height, Width] = Array() # Sip, también está bien" #: ../Doc/library/typing.rst:1963 msgid "" @@ -3365,6 +4176,9 @@ msgid "" "class Array[*Shape, *Shape]: # Not valid\n" " pass" msgstr "" +"x: tuple[*Ts, *Ts] # Not valid\n" +"class Array[*Shape, *Shape]: # Not valid\n" +" pass" #: ../Doc/library/typing.rst:1970 msgid "" @@ -3383,6 +4197,12 @@ msgid "" " ...\n" " callback(*args)" msgstr "" +"def call_soon[*Ts](\n" +" callback: Callable[[*Ts], None],\n" +" *args: *Ts\n" +") -> None:\n" +" ...\n" +" callback(*args)" #: ../Doc/library/typing.rst:1980 msgid "" @@ -3414,14 +4234,20 @@ msgid "" "The default value of the type variable tuple, or :data:`typing.NoDefault` if " "it has no default." msgstr "" +"El valor predeterminado de la variable de tipo tupla, " +"o :data:`typing.NoDefault` si no tiene valor predeterminado." #: ../Doc/library/typing.rst:2002 msgid "" "Return whether or not the type variable tuple has a default value. This is " -"equivalent to checking whether :attr:`__default__` is not the :data:`typing." -"NoDefault` singleton, except that it does not force evaluation of the :ref:" -"`lazily evaluated ` default value." +"equivalent to checking whether :attr:`__default__` is not " +"the :data:`typing.NoDefault` singleton, except that it does not force " +"evaluation of the :ref:`lazily evaluated ` default value." msgstr "" +"Devuelve si la variable de tipo tupla tiene o no un valor predeterminado. " +"Esto es equivalente a verificar si :attr:`__default__` no es el " +"singleton :data:`typing.NoDefault`, excepto que no fuerza la evaluación del " +"valor predeterminado :ref:`lazily evaluated `." #: ../Doc/library/typing.rst:2013 msgid "" @@ -3432,13 +4258,12 @@ msgstr "" "de :ref:`parámetros de tipo ` introducida por :pep:`695`." #: ../Doc/library/typing.rst:2022 -#, fuzzy msgid "" "Parameter specification variable. A specialized version of :ref:`type " "variables `." msgstr "" -"Variable de especificación de parámetros. Una versión especializada de :" -"class:`type variables `." +"Variable de especificación de parámetros. Versión especializada " +"de :ref:`type variables `." #: ../Doc/library/typing.rst:2025 msgid "" @@ -3451,7 +4276,7 @@ msgstr "" #: ../Doc/library/typing.rst:2028 msgid "type IntFunc[**P] = Callable[P, int]" -msgstr "" +msgstr "type IntFunc[**P] = Callable[P, int]" #: ../Doc/library/typing.rst:2030 msgid "" @@ -3463,7 +4288,7 @@ msgstr "" #: ../Doc/library/typing.rst:2033 msgid "P = ParamSpec('P')" -msgstr "" +msgstr "P = ParamSpec('P')" #: ../Doc/library/typing.rst:2035 msgid "" @@ -3512,6 +4337,20 @@ msgid "" " '''Add two numbers together.'''\n" " return x + y" msgstr "" +"from collections.abc import Callable\n" +"import logging\n" +"\n" +"def add_logging[T, **P](f: Callable[P, T]) -> Callable[P, T]:\n" +" '''A type-safe decorator to add logging to a function.'''\n" +" def inner(*args: P.args, **kwargs: P.kwargs) -> T:\n" +" logging.info(f'{f.__name__} was called')\n" +" return f(*args, **kwargs)\n" +" return inner\n" +"\n" +"@add_logging\n" +"def add_two(x: float, y: float) -> float:\n" +" '''Add two numbers together.'''\n" +" return x + y" #: ../Doc/library/typing.rst:2062 msgid "" @@ -3543,15 +4382,15 @@ msgstr "" #: ../Doc/library/typing.rst:2075 msgid "" -"Since ``ParamSpec`` captures both positional and keyword parameters, ``P." -"args`` and ``P.kwargs`` can be used to split a ``ParamSpec`` into its " +"Since ``ParamSpec`` captures both positional and keyword parameters, " +"``P.args`` and ``P.kwargs`` can be used to split a ``ParamSpec`` into its " "components. ``P.args`` represents the tuple of positional parameters in a " "given call and should only be used to annotate ``*args``. ``P.kwargs`` " "represents the mapping of keyword parameters to their values in a given " "call, and should be only be used to annotate ``**kwargs``. Both attributes " "require the annotated parameter to be in scope. At runtime, ``P.args`` and " -"``P.kwargs`` are instances respectively of :class:`ParamSpecArgs` and :class:" -"`ParamSpecKwargs`." +"``P.kwargs`` are instances respectively of :class:`ParamSpecArgs` " +"and :class:`ParamSpecKwargs`." msgstr "" "Dado que ``ParamSpec`` captura tanto parámetros posicionales como de " "palabras clave, ``P.args`` y ``P.kwargs`` se pueden utilizar para dividir un " @@ -3561,8 +4400,8 @@ msgstr "" "palabras clave a sus valores en una llamada determinada y solo debe usarse " "para anotar ``**kwargs``. Ambos atributos requieren que el parámetro anotado " "esté dentro del alcance. En tiempo de ejecución, ``P.args`` y ``P.kwargs`` " -"son instancias respectivamente de :class:`ParamSpecArgs` y :class:" -"`ParamSpecKwargs`." +"son instancias respectivamente de :class:`ParamSpecArgs` " +"y :class:`ParamSpecKwargs`." #: ../Doc/library/typing.rst:2087 msgid "The name of the parameter specification." @@ -3570,25 +4409,31 @@ msgstr "El nombre de la especificación del parámetro." #: ../Doc/library/typing.rst:2091 msgid "" -"The default value of the parameter specification, or :data:`typing." -"NoDefault` if it has no default." +"The default value of the parameter specification, " +"or :data:`typing.NoDefault` if it has no default." msgstr "" +"El valor predeterminado de la especificación del parámetro, " +"o :data:`typing.NoDefault` si no tiene valor predeterminado." #: ../Doc/library/typing.rst:2098 msgid "" "Return whether or not the parameter specification has a default value. This " -"is equivalent to checking whether :attr:`__default__` is not the :data:" -"`typing.NoDefault` singleton, except that it does not force evaluation of " -"the :ref:`lazily evaluated ` default value." +"is equivalent to checking whether :attr:`__default__` is not " +"the :data:`typing.NoDefault` singleton, except that it does not force " +"evaluation of the :ref:`lazily evaluated ` default value." msgstr "" +"Devuelve si la especificación del parámetro tiene o no un valor " +"predeterminado. Esto es equivalente a verificar si :attr:`__default__` no es " +"el singleton :data:`typing.NoDefault`, excepto que no fuerza la evaluación " +"del valor predeterminado :ref:`lazily evaluated `." #: ../Doc/library/typing.rst:2105 msgid "" "Parameter specification variables created with ``covariant=True`` or " "``contravariant=True`` can be used to declare covariant or contravariant " -"generic types. The ``bound`` argument is also accepted, similar to :class:" -"`TypeVar`. However the actual semantics of these keywords are yet to be " -"decided." +"generic types. The ``bound`` argument is also accepted, similar " +"to :class:`TypeVar`. However the actual semantics of these keywords are yet " +"to be decided." msgstr "" "Las variables de especificación de parámetros creadas con ``covariant=True`` " "o ``contravariant=True`` se pueden utilizar para declarar tipos genéricos " @@ -3602,8 +4447,8 @@ msgid "" "` syntax introduced by :pep:`695`." msgstr "" "Las especificaciones de parámetros ahora se pueden declarar utilizando la " -"sintaxis de :ref:`parámetros de tipo ` introducida por :pep:" -"`695`." +"sintaxis de :ref:`parámetros de tipo ` introducida " +"por :pep:`695`." #: ../Doc/library/typing.rst:2123 msgid "" @@ -3619,16 +4464,18 @@ msgstr ":data:`Concatenate`" #: ../Doc/library/typing.rst:2135 msgid "" -"Arguments and keyword arguments attributes of a :class:`ParamSpec`. The ``P." -"args`` attribute of a ``ParamSpec`` is an instance of ``ParamSpecArgs``, and " -"``P.kwargs`` is an instance of ``ParamSpecKwargs``. They are intended for " -"runtime introspection and have no special meaning to static type checkers." +"Arguments and keyword arguments attributes of a :class:`ParamSpec`. The " +"``P.args`` attribute of a ``ParamSpec`` is an instance of ``ParamSpecArgs``, " +"and ``P.kwargs`` is an instance of ``ParamSpecKwargs``. They are intended " +"for runtime introspection and have no special meaning to static type " +"checkers." msgstr "" -"Argumentos y atributos de argumentos de palabras clave de un :class:" -"`ParamSpec`. El atributo ``P.args`` de un ``ParamSpec`` es una instancia de " -"``ParamSpecArgs`` y ``P.kwargs`` es una instancia de ``ParamSpecKwargs``. " -"Están pensados para la introspección en tiempo de ejecución y no tienen un " -"significado especial para los validadores de tipo estático." +"Argumentos y atributos de argumentos de palabras clave de " +"un :class:`ParamSpec`. El atributo ``P.args`` de un ``ParamSpec`` es una " +"instancia de ``ParamSpecArgs`` y ``P.kwargs`` es una instancia de " +"``ParamSpecKwargs``. Están pensados para la introspección en tiempo de " +"ejecución y no tienen un significado especial para los validadores de tipo " +"estático." #: ../Doc/library/typing.rst:2140 msgid "" @@ -3647,6 +4494,12 @@ msgid "" ">>> get_origin(P.kwargs) is P\n" "True" msgstr "" +">>> from typing import ParamSpec, get_origin\n" +">>> P = ParamSpec(\"P\")\n" +">>> get_origin(P.args) is P\n" +"True\n" +">>> get_origin(P.kwargs) is P\n" +"True" #: ../Doc/library/typing.rst:2157 msgid "The type of type aliases created through the :keyword:`type` statement." @@ -3659,6 +4512,9 @@ msgid "" ">>> type(Alias)\n" "" msgstr "" +">>> type Alias = int\n" +">>> type(Alias)\n" +"" #: ../Doc/library/typing.rst:2171 msgid "The name of the type alias:" @@ -3670,6 +4526,9 @@ msgid "" ">>> Alias.__name__\n" "'Alias'" msgstr "" +">>> type Alias = int\n" +">>> Alias.__name__\n" +"'Alias'" #: ../Doc/library/typing.rst:2181 msgid "The module in which the type alias was defined::" @@ -3681,6 +4540,9 @@ msgid "" ">>> Alias.__module__\n" "'__main__'" msgstr "" +">>> type Alias = int\n" +">>> Alias.__module__\n" +"'__main__'" #: ../Doc/library/typing.rst:2189 msgid "" @@ -3699,6 +4561,12 @@ msgid "" ">>> NotGeneric.__type_params__\n" "()" msgstr "" +">>> type ListOrSet[T] = list[T] | set[T]\n" +">>> ListOrSet.__type_params__\n" +"(T,)\n" +">>> type NotGeneric = int\n" +">>> NotGeneric.__type_params__\n" +"()" #: ../Doc/library/typing.rst:2203 msgid "" @@ -3723,6 +4591,16 @@ msgid "" ">>> Recursive.__value__\n" "Mutually" msgstr "" +">>> type Mutually = Recursive\n" +">>> type Recursive = Mutually\n" +">>> Mutually\n" +"Mutually\n" +">>> Recursive\n" +"Recursive\n" +">>> Mutually.__value__\n" +"Recursive\n" +">>> Recursive.__value__\n" +"Mutually" #: ../Doc/library/typing.rst:2221 msgid "Other special directives" @@ -3753,6 +4631,9 @@ msgid "" " name: str\n" " id: int" msgstr "" +"class Employee(NamedTuple):\n" +" name: str\n" +" id: int" #: ../Doc/library/typing.rst:2237 msgid "This is equivalent to::" @@ -3760,7 +4641,7 @@ msgstr "Esto es equivalente a::" #: ../Doc/library/typing.rst:2239 msgid "Employee = collections.namedtuple('Employee', ['name', 'id'])" -msgstr "" +msgstr "Employee = collections.namedtuple('Employee', ['name', 'id'])" #: ../Doc/library/typing.rst:2241 msgid "" @@ -3778,6 +4659,12 @@ msgid "" "employee = Employee('Guido')\n" "assert employee.id == 3" msgstr "" +"class Employee(NamedTuple):\n" +" name: str\n" +" id: int = 3\n" +"\n" +"employee = Employee('Guido')\n" +"assert employee.id == 3" #: ../Doc/library/typing.rst:2250 msgid "" @@ -3815,6 +4702,13 @@ msgid "" " def __repr__(self) -> str:\n" " return f''" msgstr "" +"class Employee(NamedTuple):\n" +" \"\"\"Represents an employee.\"\"\"\n" +" name: str\n" +" id: int = 3\n" +"\n" +" def __repr__(self) -> str:\n" +" return f''" #: ../Doc/library/typing.rst:2268 msgid "``NamedTuple`` subclasses can be generic::" @@ -3826,6 +4720,9 @@ msgid "" " key: T\n" " group: list[T]" msgstr "" +"class Group[T](NamedTuple):\n" +" key: T\n" +" group: list[T]" #: ../Doc/library/typing.rst:2274 msgid "Backward-compatible usage::" @@ -3843,12 +4740,21 @@ msgid "" "# A functional syntax is also supported\n" "Employee = NamedTuple('Employee', [('name', str), ('id', int)])" msgstr "" +"# Para crear un NamedTuple genérico en Python 3.11\n" +"T = TypeVar(\"T\")\n" +"\n" +"class Group(NamedTuple, Generic[T]):\n" +" key: T\n" +" group: list[T]\n" +"\n" +"# También se admite una sintaxis funcional\n" +"Employee = NamedTuple('Employee', [('name', str), ('id', int)])" #: ../Doc/library/typing.rst:2286 msgid "Added support for :pep:`526` variable annotation syntax." msgstr "" -"Soporte añadido para la sintaxis de anotación de variables propuesto en :pep:" -"`526`." +"Soporte añadido para la sintaxis de anotación de variables propuesto " +"en :pep:`526`." #: ../Doc/library/typing.rst:2289 msgid "Added support for default values, methods, and docstrings." @@ -3880,6 +4786,10 @@ msgid "" "(``NT = NamedTuple(\"NT\", x=int)``) is deprecated, and will be disallowed " "in 3.15. Use the class-based syntax or the functional syntax instead." msgstr "" +"La sintaxis de argumentos de palabras clave no documentada para crear clases " +"NamedTuple (``NT = NamedTuple(\"NT\", x=int)``) está obsoleta y no se " +"permitirá en la versión 3.15. En su lugar, utilice la sintaxis basada en " +"clases o la sintaxis funcional." #: ../Doc/library/typing.rst:2308 msgid "" @@ -3890,6 +4800,12 @@ msgid "" "Python 3.15. To create a NamedTuple class with 0 fields, use ``class " "NT(NamedTuple): pass`` or ``NT = NamedTuple(\"NT\", [])``." msgstr "" +"Al utilizar la sintaxis funcional para crear una clase NamedTuple, no se " +"permite pasar un valor al parámetro 'campos' (``NT = NamedTuple(\"NT\")``). " +"También se permite pasar ``None`` al parámetro 'campos' (``NT = " +"NamedTuple(\"NT\", None)``). Ambos métodos no estarán permitidos en Python " +"3.15. Para crear una clase NamedTuple con 0 campos, utilice ``class " +"NT(NamedTuple): pass`` o ``NT = NamedTuple(\"NT\", [])``." #: ../Doc/library/typing.rst:2318 msgid "Helper class to create low-overhead :ref:`distinct types `." @@ -3912,6 +4828,9 @@ msgid "" "first_user = UserId(1) # \"UserId\" returns the argument unchanged at " "runtime" msgstr "" +"UserId = NewType('UserId', int) # Declara el NewType \"UserId\"\n" +"first_user = UserId(1) # \"UserId\" retorna el argumento sin cambios en " +"runtime" #: ../Doc/library/typing.rst:2330 msgid "The module in which the new type is defined." @@ -3943,6 +4862,9 @@ msgid "" " def meth(self) -> int:\n" " ..." msgstr "" +"class Proto(Protocol):\n" +" def meth(self) -> int:\n" +" ..." #: ../Doc/library/typing.rst:2355 msgid "" @@ -3963,18 +4885,26 @@ msgid "" "\n" "func(C()) # Passes static type check" msgstr "" +"class C:\n" +" def meth(self) -> int:\n" +" return 0\n" +"\n" +"def func(x: Proto) -> int:\n" +" return x.meth()\n" +"\n" +"func(C()) # Pasa la verificación de tipos estática" #: ../Doc/library/typing.rst:2367 msgid "" -"See :pep:`544` for more details. Protocol classes decorated with :func:" -"`runtime_checkable` (described later) act as simple-minded runtime protocols " -"that check only the presence of given attributes, ignoring their type " -"signatures." +"See :pep:`544` for more details. Protocol classes decorated " +"with :func:`runtime_checkable` (described later) act as simple-minded " +"runtime protocols that check only the presence of given attributes, ignoring " +"their type signatures." msgstr "" -"Véase :pep:`544` para más detalles. Las clases protocolo decoradas con :func:" -"`runtime_checkable` (descrito más adelante) se comportan como protocolos " -"simplistas en tiempo de ejecución que solo comprueban la presencia de " -"atributos dados, ignorando su firma de tipo." +"Véase :pep:`544` para más detalles. Las clases protocolo decoradas " +"con :func:`runtime_checkable` (descrito más adelante) se comportan como " +"protocolos simplistas en tiempo de ejecución que solo comprueban la " +"presencia de atributos dados, ignorando su firma de tipo." #: ../Doc/library/typing.rst:2372 msgid "Protocol classes can be generic, for example::" @@ -3986,6 +4916,9 @@ msgid "" " def meth(self) -> T:\n" " ..." msgstr "" +"class GenProto[T](Protocol):\n" +" def meth(self) -> T:\n" +" ..." #: ../Doc/library/typing.rst:2378 msgid "" @@ -4003,6 +4936,11 @@ msgid "" " def meth(self) -> T:\n" " ..." msgstr "" +"T = TypeVar(\"T\")\n" +"\n" +"class GenProto(Protocol[T]):\n" +" def meth(self) -> T:\n" +" ..." #: ../Doc/library/typing.rst:2391 msgid "Mark a protocol class as a runtime protocol." @@ -4015,14 +4953,14 @@ msgid "" "Such a protocol can be used with :func:`isinstance` and :func:`issubclass`. " "This raises :exc:`TypeError` when applied to a non-protocol class. This " "allows a simple-minded structural check, very similar to \"one trick " -"ponies\" in :mod:`collections.abc` such as :class:`~collections.abc." -"Iterable`. For example::" +"ponies\" in :mod:`collections.abc` such " +"as :class:`~collections.abc.Iterable`. For example::" msgstr "" "Tal protocolo se puede usar con :func:`isinstance` y :func:`issubclass`. " "Esto lanzará una excepción :exc:`TypeError` cuando se aplique a una clase " "que no es un protocolo. Esto permite una comprobación estructural simple, " -"muy semejante a \"one trick ponies\" en :mod:`collections.abc` con :class:" -"`Iterable`. Por ejemplo::" +"muy semejante a \"one trick ponies\" en :mod:`collections.abc` " +"con :class:`Iterable`. Por ejemplo::" #: ../Doc/library/typing.rst:2398 msgid "" @@ -4039,24 +4977,36 @@ msgid "" "import threading\n" "assert isinstance(threading.Thread(name='Bob'), Named)" msgstr "" +"@runtime_checkable\n" +"class Closable(Protocol):\n" +" def close(self): ...\n" +"\n" +"assert isinstance(open('/some/file'), Closable)\n" +"\n" +"@runtime_checkable\n" +"class Named(Protocol):\n" +" name: str\n" +"\n" +"import threading\n" +"assert isinstance(threading.Thread(name='Bob'), Named)" #: ../Doc/library/typing.rst:2413 msgid "" ":func:`!runtime_checkable` will check only the presence of the required " -"methods or attributes, not their type signatures or types. For example, :" -"class:`ssl.SSLObject` is a class, therefore it passes an :func:`issubclass` " -"check against :ref:`Callable `. However, the ``ssl." -"SSLObject.__init__`` method exists only to raise a :exc:`TypeError` with a " -"more informative message, therefore making it impossible to call " -"(instantiate) :class:`ssl.SSLObject`." +"methods or attributes, not their type signatures or types. For " +"example, :class:`ssl.SSLObject` is a class, therefore it passes " +"an :func:`issubclass` check against :ref:`Callable `. " +"However, the ``ssl.SSLObject.__init__`` method exists only to raise " +"a :exc:`TypeError` with a more informative message, therefore making it " +"impossible to call (instantiate) :class:`ssl.SSLObject`." msgstr "" ":func:`!runtime_checkable` comprobará únicamente la presencia de los métodos " -"o atributos requeridos, no sus firmas de tipo o tipos. Por ejemplo, :class:" -"`ssl.SSLObject` es una clase, por lo tanto, pasa una comprobación :func:" -"`issubclass` contra :ref:`Callable `. Sin embargo, el " -"método ``ssl.SSLObject.__init__`` existe únicamente para generar un :exc:" -"`TypeError` con un mensaje más informativo, por lo que es imposible llamar " -"(instanciar) :class:`ssl.SSLObject`." +"o atributos requeridos, no sus firmas de tipo o tipos. Por " +"ejemplo, :class:`ssl.SSLObject` es una clase, por lo tanto, pasa una " +"comprobación :func:`issubclass` contra :ref:`Callable `. Sin embargo, el método ``ssl.SSLObject.__init__`` existe " +"únicamente para generar un :exc:`TypeError` con un mensaje más informativo, " +"por lo que es imposible llamar (instanciar) :class:`ssl.SSLObject`." #: ../Doc/library/typing.rst:2424 msgid "" @@ -4081,9 +5031,9 @@ msgid "" "versa. Most users are unlikely to be affected by this change." msgstr "" "La implementación interna de las comprobaciones de :func:`isinstance` con " -"protocolos que se pueden comprobar en tiempo de ejecución ahora utiliza :" -"func:`inspect.getattr_static` para buscar atributos (anteriormente, se " -"utilizaba :func:`hasattr`). Como resultado, algunos objetos que solían " +"protocolos que se pueden comprobar en tiempo de ejecución ahora " +"utiliza :func:`inspect.getattr_static` para buscar atributos (anteriormente, " +"se utilizaba :func:`hasattr`). Como resultado, algunos objetos que solían " "considerarse instancias de un protocolo que se podía comprobar en tiempo de " "ejecución ya no se consideran instancias de ese protocolo en Python 3.12+, y " "viceversa. Es poco probable que la mayoría de los usuarios se vean afectados " @@ -4094,8 +5044,9 @@ msgid "" "The members of a runtime-checkable protocol are now considered \"frozen\" at " "runtime as soon as the class has been created. Monkey-patching attributes " "onto a runtime-checkable protocol will still work, but will have no impact " -"on :func:`isinstance` checks comparing objects to the protocol. See :ref:" -"`\"What's new in Python 3.12\" ` for more details." +"on :func:`isinstance` checks comparing objects to the protocol. " +"See :ref:`\"What's new in Python 3.12\" ` for more " +"details." msgstr "" "Los miembros de un protocolo que se pueden comprobar en tiempo de ejecución " "ahora se consideran \"congelados\" en tiempo de ejecución tan pronto como se " @@ -4138,27 +5089,38 @@ msgid "" "\n" "assert Point2D(x=1, y=2, label='first') == dict(x=1, y=2, label='first')" msgstr "" +"class Point2D(TypedDict):\n" +" x: int\n" +" y: int\n" +" label: str\n" +"\n" +"a: Point2D = {'x': 1, 'y': 2, 'label': 'good'} # OK\n" +"b: Point2D = {'z': 3, 'label': 'bad'} # Falla la verificación de " +"tipos\n" +"\n" +"assert Point2D(x=1, y=2, label='first') == dict(x=1, y=2, label='first')" #: ../Doc/library/typing.rst:2471 msgid "" "An alternative way to create a ``TypedDict`` is by using function-call " "syntax. The second argument must be a literal :class:`dict`::" msgstr "" +"Una forma alternativa de crear un ``TypedDict`` es mediante la sintaxis de " +"llamada de función. El segundo argumento debe ser un :class:`dict` literal::" #: ../Doc/library/typing.rst:2474 msgid "Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': str})" -msgstr "" +msgstr "Punto2D = TypedDict('Punto2D', {'x': int, 'y': int, 'etiqueta': str})" #: ../Doc/library/typing.rst:2476 -#, fuzzy msgid "" -"This functional syntax allows defining keys which are not valid :ref:" -"`identifiers `, for example because they are keywords or " -"contain hyphens::" +"This functional syntax allows defining keys which are not " +"valid :ref:`identifiers `, for example because they are " +"keywords or contain hyphens::" msgstr "" -"También es preferible el uso de la sintaxis funcional cuando cualquiera de " -"las llaves no sean :ref:`identifiers` válidos, por ejemplo " -"porque son palabras clave o contienen guiones. Ejemplo::" +"Esta sintaxis funcional permite definir claves que no son " +"válidas :ref:`identifiers `, por ejemplo porque son palabras " +"clave o contienen guiones:" #: ../Doc/library/typing.rst:2480 msgid "" @@ -4170,6 +5132,13 @@ msgid "" "# OK, functional syntax\n" "Point2D = TypedDict('Point2D', {'in': int, 'x-y': int})" msgstr "" +"# lanza SyntaxError\n" +"class Point2D(TypedDict):\n" +" in: int # 'in' es una palabra clave\n" +" x-y: int # nombre con guiones\n" +"\n" +"# OK, sintaxis funcional\n" +"Point2D = TypedDict('Point2D', {'in': int, 'x-y': int})" #: ../Doc/library/typing.rst:2488 msgid "" @@ -4187,10 +5156,18 @@ msgid "" " y: int\n" " label: NotRequired[str]\n" "\n" -"# Alternative syntax\n" +"# Alternative syntax\n" +"Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': " +"NotRequired[str]})" +msgstr "" +"class Point2D(TypedDict):\n" +" x: int\n" +" y: int\n" +" label: NotRequired[str]\n" +"\n" +"# Sintaxis alternativa\n" "Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': " "NotRequired[str]})" -msgstr "" #: ../Doc/library/typing.rst:2499 msgid "" @@ -4217,6 +5194,12 @@ msgid "" "# Alternative syntax\n" "Point2D = TypedDict('Point2D', {'x': int, 'y': int}, total=False)" msgstr "" +"class Point2D(TypedDict, total=False):\n" +" x: int\n" +" y: int\n" +"\n" +"# Sintaxis alternativa\n" +"Point2D = TypedDict('Point2D', {'x': int, 'y': int}, total=False)" #: ../Doc/library/typing.rst:2512 msgid "" @@ -4253,6 +5236,17 @@ msgid "" " 'label': str\n" "}, total=False)" msgstr "" +"class Point2D(TypedDict, total=False):\n" +" x: Required[int]\n" +" y: Required[int]\n" +" label: str\n" +"\n" +"# Sintaxis alternativa\n" +"Point2D = TypedDict('Point2D', {\n" +" 'x': Required[int],\n" +" 'y': Required[int],\n" +" 'label': str\n" +"}, total=False)" #: ../Doc/library/typing.rst:2532 msgid "" @@ -4267,6 +5261,8 @@ msgid "" "class Point3D(Point2D):\n" " z: int" msgstr "" +"class Point3D(Point2D):\n" +" z: int" #: ../Doc/library/typing.rst:2539 msgid "" @@ -4283,6 +5279,10 @@ msgid "" " y: int\n" " z: int" msgstr "" +"class Point3D(TypedDict):\n" +" x: int\n" +" y: int\n" +" z: int" #: ../Doc/library/typing.rst:2547 msgid "" @@ -4306,6 +5306,17 @@ msgid "" "\n" "class XZ(X, Z): pass # raises TypeError" msgstr "" +"class X(TypedDict):\n" +" x: int\n" +"\n" +"class Y(TypedDict):\n" +" y: int\n" +"\n" +"class Z(object): pass # Una clase no-TypedDict\n" +"\n" +"class XY(X, Y): pass # OK\n" +"\n" +"class XZ(X, Z): pass # lanza TypeError" #: ../Doc/library/typing.rst:2562 msgid "A ``TypedDict`` can be generic::" @@ -4317,6 +5328,9 @@ msgid "" " key: T\n" " group: list[T]" msgstr "" +"class Group[T](TypedDict):\n" +" key: T\n" +" group: list[T]" #: ../Doc/library/typing.rst:2568 msgid "" @@ -4334,18 +5348,24 @@ msgid "" " key: T\n" " group: list[T]" msgstr "" +"T = TypeVar(\"T\")\n" +"\n" +"class Group(TypedDict, Generic[T]):\n" +" key: T\n" +" group: list[T]" #: ../Doc/library/typing.rst:2579 msgid "" -"A ``TypedDict`` can be introspected via annotations dicts (see :ref:" -"`annotations-howto` for more information on annotations best practices), :" -"attr:`__total__`, :attr:`__required_keys__`, and :attr:`__optional_keys__`." +"A ``TypedDict`` can be introspected via annotations dicts " +"(see :ref:`annotations-howto` for more information on annotations best " +"practices), :attr:`__total__`, :attr:`__required_keys__`, " +"and :attr:`__optional_keys__`." msgstr "" "Es posible introspectar un ``TypedDict`` a través de diccionarios de " "anotaciones (véase\n" " :ref:`annotations-howto` para más información acerca de mejores prácticas " -"de anotaciones), :attr:`__total__`, :attr:`__required_keys__`, y :attr:" -"`__optional_keys__`." +"de anotaciones), :attr:`__total__`, :attr:`__required_keys__`, " +"y :attr:`__optional_keys__`." #: ../Doc/library/typing.rst:2585 msgid "" @@ -4366,6 +5386,16 @@ msgid "" ">>> Point3D.__total__\n" "True" msgstr "" +">>> from typing import TypedDict\n" +">>> class Point2D(TypedDict): pass\n" +">>> Point2D.__total__\n" +"True\n" +">>> class Point2D(TypedDict, total=False): pass\n" +">>> Point2D.__total__\n" +"False\n" +">>> class Point3D(Point2D): pass\n" +">>> Point3D.__total__\n" +"True" #: ../Doc/library/typing.rst:2601 msgid "" @@ -4377,11 +5407,18 @@ msgid "" "use :attr:`__required_keys__` and :attr:`__optional_keys__` for " "introspection." msgstr "" +"Este atributo refleja el valor del argumento ``total`` de la clase " +"``TypedDict`` actual, no si la clase es semánticamente total. Por ejemplo, " +"una ``TypedDict`` con ``__total__`` establecida en ``True`` puede tener " +"claves marcadas con :data:`NotRequired`, o puede heredar de otra " +"``TypedDict`` con ``total=False``. Por lo tanto, generalmente es mejor " +"usar :attr:`__required_keys__` y :attr:`__optional_keys__` para la " +"introspección." #: ../Doc/library/typing.rst:2614 msgid "" -"``Point2D.__required_keys__`` and ``Point2D.__optional_keys__`` return :" -"class:`frozenset` objects containing required and non-required keys, " +"``Point2D.__required_keys__`` and ``Point2D.__optional_keys__`` " +"return :class:`frozenset` objects containing required and non-required keys, " "respectively." msgstr "" "``Point2D.__required_keys__`` y ``Point2D.__optional_keys__`` retornan " @@ -4426,6 +5463,17 @@ msgid "" ">>> Point3D.__optional_keys__ == frozenset({'x', 'y'})\n" "True" msgstr "" +">>> class Point2D(TypedDict, total=False):\n" +"... x: int\n" +"... y: int\n" +"...\n" +">>> class Point3D(Point2D):\n" +"... z: int\n" +"...\n" +">>> Point3D.__required_keys__ == frozenset({'z'})\n" +"True\n" +">>> Point3D.__optional_keys__ == frozenset({'x', 'y'})\n" +"True" #: ../Doc/library/typing.rst:2645 msgid "" @@ -4435,22 +5483,35 @@ msgid "" "``__optional_keys__`` rely on may not work properly, and the values of the " "attributes may be incorrect." msgstr "" +"Si se utiliza ``from __future__ import annotations`` o si las anotaciones se " +"proporcionan como cadenas, las anotaciones no se evalúan cuando se define " +"``TypedDict``. Por lo tanto, la introspección en tiempo de ejecución de la " +"que dependen ``__required_keys__`` y ``__optional_keys__`` puede no " +"funcionar correctamente y los valores de los atributos pueden ser " +"incorrectos." #: ../Doc/library/typing.rst:2651 msgid "Support for :data:`ReadOnly` is reflected in the following attributes:" msgstr "" +"La compatibilidad con :data:`ReadOnly` se refleja en los siguientes " +"atributos:" #: ../Doc/library/typing.rst:2655 msgid "" "A :class:`frozenset` containing the names of all read-only keys. Keys are " "read-only if they carry the :data:`ReadOnly` qualifier." msgstr "" +"Un :class:`frozenset` que contiene los nombres de todas las claves de solo " +"lectura. Las claves son de solo lectura si llevan el " +"calificador :data:`ReadOnly`." #: ../Doc/library/typing.rst:2662 msgid "" "A :class:`frozenset` containing the names of all mutable keys. Keys are " "mutable if they do not carry the :data:`ReadOnly` qualifier." msgstr "" +"Un :class:`frozenset` que contiene los nombres de todas las claves mutables. " +"Las claves son mutables si no llevan el calificador :data:`ReadOnly`." #: ../Doc/library/typing.rst:2667 msgid "" @@ -4461,26 +5522,27 @@ msgstr "" #: ../Doc/library/typing.rst:2671 msgid "" -"Added support for marking individual keys as :data:`Required` or :data:" -"`NotRequired`. See :pep:`655`." +"Added support for marking individual keys as :data:`Required` " +"or :data:`NotRequired`. See :pep:`655`." msgstr "" -"Se agrega soporte para marcar llaves individuales como :data:`Required` o :" -"data:`NotRequired`. Véase :pep:`655`." +"Se agrega soporte para marcar llaves individuales como :data:`Required` " +"o :data:`NotRequired`. Véase :pep:`655`." #: ../Doc/library/typing.rst:2675 msgid "Added support for generic ``TypedDict``\\ s." msgstr "Se agrega soporte para ``TypedDict`` genéricos." #: ../Doc/library/typing.rst:2678 -#, fuzzy msgid "" "Removed support for the keyword-argument method of creating ``TypedDict``\\ " "s." -msgstr "Se agrega soporte para ``TypedDict`` genéricos." +msgstr "" +"Se eliminó la compatibilidad con el método de argumento de palabra clave " +"para crear ``TypedDict``\\ s." #: ../Doc/library/typing.rst:2681 msgid "Support for the :data:`ReadOnly` qualifier was added." -msgstr "" +msgstr "Se agregó soporte para el calificador :data:`ReadOnly`." #: ../Doc/library/typing.rst:2684 msgid "" @@ -4491,6 +5553,12 @@ msgid "" "Python 3.15. To create a TypedDict class with 0 fields, use ``class " "TD(TypedDict): pass`` or ``TD = TypedDict(\"TD\", {})``." msgstr "" +"Al utilizar la sintaxis funcional para crear una clase TypedDict, no se " +"permite pasar un valor al parámetro 'campos' (``TD = TypedDict(\"TD\")``). " +"También se permite pasar ``None`` al parámetro 'campos' (``TD = " +"TypedDict(\"TD\", None)``). Ambos métodos no estarán permitidos en Python " +"3.15. Para crear una clase TypedDict con 0 campos, utilice ``class " +"TD(TypedDict): pass`` o ``TD = TypedDict(\"TD\", {})``." #: ../Doc/library/typing.rst:2693 msgid "Protocols" @@ -4603,6 +5671,9 @@ msgid "" " assert_type(name, str) # OK, inferred type of `name` is `str`\n" " assert_type(name, int) # type checker error" msgstr "" +"def greet(name: str) -> None:\n" +" assert_type(name, str) # OK, tipo inferido de `name` es `str`\n" +" assert_type(name, int) # error del verificador de tipos" #: ../Doc/library/typing.rst:2768 msgid "" @@ -4622,6 +5693,13 @@ msgid "" " # Test whether the type checker correctly understands our function\n" " assert_type(arg, int)" msgstr "" +"def complex_function(arg: object):\n" +" # Haz alguna lógica compleja de reducción de tipo,\n" +" # despues de la cual esperamos que el tipo inferido sea `int`\n" +" ...\n" +" # Probar si el verificador de tipos entiende correctamente nuestra " +"función\n" +" assert_type(arg, int)" #: ../Doc/library/typing.rst:2782 msgid "" @@ -4645,6 +5723,14 @@ msgid "" " case _ as unreachable:\n" " assert_never(unreachable)" msgstr "" +"def int_or_str(arg: int | str) -> None:\n" +" match arg:\n" +" case int():\n" +" print(\"It's an int\")\n" +" case str():\n" +" print(\"It's a str\")\n" +" case _ as unreachable:\n" +" assert_never(unreachable)" #: ../Doc/library/typing.rst:2795 msgid "" @@ -4653,8 +5739,8 @@ msgid "" "and both options are covered by earlier cases." msgstr "" "Aquí, las anotaciones permiten al validador de tipos inferir que el último " -"caso nunca puede ejecutarse, porque ``arg`` es un :class:`int` o un :class:" -"`str`, y ambas opciones están cubiertas por los casos anteriores." +"caso nunca puede ejecutarse, porque ``arg`` es un :class:`int` o " +"un :class:`str`, y ambas opciones están cubiertas por los casos anteriores." #: ../Doc/library/typing.rst:2800 msgid "" @@ -4668,47 +5754,47 @@ msgstr "" "Si un validador de tipos encuentra que una llamada a ``assert_never()`` es " "alcanzable, emitirá un error. Por ejemplo, si la anotación de tipo para " "``arg`` fuese en cambio ``int | str | float``, el validador de tipos " -"emitiría un error que indicaría que ``unreachable`` es de tipo :class:" -"`float`. Para que una llamada a ``assert_never`` pase la verificación de " -"tipos, el tipo inferido del argumento pasado debe ser el tipo inferior, :" -"data:`Never`, y nada más." +"emitiría un error que indicaría que ``unreachable`` es de " +"tipo :class:`float`. Para que una llamada a ``assert_never`` pase la " +"verificación de tipos, el tipo inferido del argumento pasado debe ser el " +"tipo inferior, :data:`Never`, y nada más." #: ../Doc/library/typing.rst:2808 msgid "At runtime, this throws an exception when called." msgstr "En tiempo de ejecución, ésto lanza una excepción cuando es llamado." #: ../Doc/library/typing.rst:2811 -#, fuzzy msgid "" "`Unreachable Code and Exhaustiveness Checking `__ has more information about " "exhaustiveness checking with static typing." msgstr "" "`Unreachable Code and Exhaustiveness Checking `__ contiene más información acerca de la " -"verificación de exhaustividad con tipado estático." +"en/latest/guides/unreachable.html>`__ tiene más información sobre la " +"comprobación de exhaustividad con tipado estático." #: ../Doc/library/typing.rst:2819 -#, fuzzy msgid "Ask a static type checker to reveal the inferred type of an expression." msgstr "" -"Solicitar a un validador de tipos que confirme que *val* tiene *typ* por " -"tipo inferido." +"Pídale a un verificador de tipos estáticos que revele el tipo inferido de " +"una expresión." #: ../Doc/library/typing.rst:2821 -#, fuzzy msgid "" "When a static type checker encounters a call to this function, it emits a " "diagnostic with the inferred type of the argument. For example::" msgstr "" -"Cuando un validador estático de tipos se encuentra con una invocación a esta " -"función, emite un diagnostico con el tipo del argumento. Por ejemplo::" +"Cuando un verificador de tipos estáticos encuentra una llamada a esta " +"función, emite un diagnóstico con el tipo inferido del argumento. Por " +"ejemplo:" #: ../Doc/library/typing.rst:2824 msgid "" "x: int = 1\n" "reveal_type(x) # Revealed type is \"builtins.int\"" msgstr "" +"x: int = 1\n" +"reveal_type(x) # Tipo revelado es \"builtins.int\"" #: ../Doc/library/typing.rst:2827 msgid "" @@ -4719,44 +5805,49 @@ msgstr "" "tipos maneja una pieza particular de código." #: ../Doc/library/typing.rst:2830 -#, fuzzy msgid "" -"At runtime, this function prints the runtime type of its argument to :data:" -"`sys.stderr` and returns the argument unchanged (allowing the call to be " -"used within an expression)::" +"At runtime, this function prints the runtime type of its argument " +"to :data:`sys.stderr` and returns the argument unchanged (allowing the call " +"to be used within an expression)::" msgstr "" -"En tiempo de ejecución, esta función imprime al *stderr* el tipo en tiempo " -"de ejecución de su argumento y lo retorna in cambios::" +"En tiempo de ejecución, esta función imprime el tipo de tiempo de ejecución " +"de su argumento en :data:`sys.stderr` y devuelve el argumento sin cambios " +"(lo que permite que la llamada se use dentro de una expresión):" #: ../Doc/library/typing.rst:2834 msgid "" "x = reveal_type(1) # prints \"Runtime type is int\"\n" "print(x) # prints \"1\"" msgstr "" +"x = reveal_type(1) # imprime \"Runtime type is int\"\n" +"print(x) # prints \"1\"" #: ../Doc/library/typing.rst:2837 msgid "" "Note that the runtime type may be different from (more or less specific " "than) the type statically inferred by a type checker." msgstr "" +"Tenga en cuenta que el tipo de tiempo de ejecución puede ser diferente (más " +"o menos específico) del tipo inferido estáticamente por un verificador de " +"tipos." #: ../Doc/library/typing.rst:2840 -#, fuzzy msgid "" "Most type checkers support ``reveal_type()`` anywhere, even if the name is " "not imported from ``typing``. Importing the name from ``typing``, however, " "allows your code to run without runtime errors and communicates intent more " "clearly." msgstr "" -"La mayoría de los validadores de tipos soportan ``reveal_type()`` en " -"cualquier lugar, incluso si el nombre no ha sido importado desde ``typing``. " -"Importar el nombre desde ``typing`` permite que el código corra sin errores " -"en tiempo de ejecución y comunica la intención de forma más clara." +"La mayoría de los verificadores de tipos admiten ``reveal_type()`` en " +"cualquier lugar, incluso si el nombre no se importa desde ``typing``. Sin " +"embargo, importar el nombre desde ``typing`` permite que el código se " +"ejecute sin errores de tiempo de ejecución y comunica la intención con mayor " +"claridad." #: ../Doc/library/typing.rst:2851 msgid "" -"Decorator to mark an object as providing :func:`dataclass `-like behavior." +"Decorator to mark an object as providing :func:`dataclass " +"`-like behavior." msgstr "" "Decorador para marcar un objeto como si proporcionara un comportamiento " "similar a :func:`dataclass `." @@ -4773,8 +5864,8 @@ msgstr "" "o una función que sea en sí misma un decorador. La presencia de " "``@dataclass_transform()`` le indica al validador de tipos estáticos que el " "objeto decorado realiza una \"magia\" en tiempo de ejecución que transforma " -"una clase de manera similar a :func:`@dataclasses.dataclass `." +"una clase de manera similar a :func:`@dataclasses.dataclass " +"`." #: ../Doc/library/typing.rst:2861 msgid "Example usage with a decorator function:" @@ -4792,6 +5883,15 @@ msgid "" " id: int\n" " name: str" msgstr "" +"@dataclass_transform()\n" +"def create_model[T](cls: type[T]) -> type[T]:\n" +" ...\n" +" return cls\n" +"\n" +"@create_model\n" +"class CustomerModel:\n" +" id: int\n" +" name: str" #: ../Doc/library/typing.rst:2875 msgid "On a base class::" @@ -4806,6 +5906,12 @@ msgid "" " id: int\n" " name: str" msgstr "" +"@dataclass_transform()\n" +"class ModelBase: ...\n" +"\n" +"class CustomerModel(ModelBase):\n" +" id: int\n" +" name: str" #: ../Doc/library/typing.rst:2884 msgid "On a metaclass::" @@ -4822,19 +5928,27 @@ msgid "" " id: int\n" " name: str" msgstr "" +"@dataclass_transform()\n" +"class ModelMeta(type): ...\n" +"\n" +"class ModelBase(metaclass=ModelMeta): ...\n" +"\n" +"class CustomerModel(ModelBase):\n" +" id: int\n" +" name: str" #: ../Doc/library/typing.rst:2895 msgid "" "The ``CustomerModel`` classes defined above will be treated by type checkers " -"similarly to classes created with :func:`@dataclasses.dataclass `. For example, type checkers will assume these classes have " -"``__init__`` methods that accept ``id`` and ``name``." +"similarly to classes created with :func:`@dataclasses.dataclass " +"`. For example, type checkers will assume these " +"classes have ``__init__`` methods that accept ``id`` and ``name``." msgstr "" "Las clases ``CustomerModel`` definidas arribe serán tratadas por los " -"validadores de tipo de forma similar a las clases que sean creadas con :" -"func:`@dataclasses.dataclass `. Por ejemplo, los " -"validadores de tipo asumirán que estas clases tienen métodos ``__init__`` " -"que aceptan ``id`` y ``name``." +"validadores de tipo de forma similar a las clases que sean creadas " +"con :func:`@dataclasses.dataclass `. Por ejemplo, " +"los validadores de tipo asumirán que estas clases tienen métodos " +"``__init__`` que aceptan ``id`` y ``name``." #: ../Doc/library/typing.rst:2901 msgid "" @@ -4847,11 +5961,11 @@ msgid "" msgstr "" "La clase, metaclase o función decorada puede aceptar los siguientes " "argumentos booleanos, de los cuales los validadores de tipos asumirán que " -"tienen el mismo efecto que tendrían en el decorador :func:`@dataclasses." -"dataclass`: ``init``, ``eq``, ``order``, " -"``unsafe_hash``, ``frozen``, ``match_args``, ``kw_only``, y ``slots``. Debe " -"ser posible evaluar estáticamente el valor de estos argumentos (``True`` o " -"``False``)." +"tienen el mismo efecto que tendrían en el " +"decorador :func:`@dataclasses.dataclass`: ``init``, " +"``eq``, ``order``, ``unsafe_hash``, ``frozen``, ``match_args``, ``kw_only``, " +"y ``slots``. Debe ser posible evaluar estáticamente el valor de estos " +"argumentos (``True`` o ``False``)." #: ../Doc/library/typing.rst:2909 msgid "" @@ -5064,8 +6178,8 @@ msgid "" "only, since they will be overwritten by the non-``@overload``-decorated " "definition. The non-``@overload``-decorated definition, meanwhile, will be " "used at runtime but should be ignored by a type checker. At runtime, " -"calling an ``@overload``-decorated function directly will raise :exc:" -"`NotImplementedError`." +"calling an ``@overload``-decorated function directly will " +"raise :exc:`NotImplementedError`." msgstr "" "Las definiciones decoradas con ``@overload`` son solo para beneficio del " "validador de tipos, ya que serán sobrescritas por la definición no decorada " @@ -5096,6 +6210,17 @@ msgid "" "def process(response):\n" " ... # actual implementation goes here" msgstr "" +"@overload\n" +"def process(response: None) -> None:\n" +" ...\n" +"@overload\n" +"def process(response: int) -> tuple[int, str]:\n" +" ...\n" +"@overload\n" +"def process(response: bytes) -> str:\n" +" ...\n" +"def process(response):\n" +" ... # actual implementation goes here" #: ../Doc/library/typing.rst:3023 msgid "" @@ -5106,8 +6231,8 @@ msgstr "" #: ../Doc/library/typing.rst:3025 msgid "" -"Overloaded functions can now be introspected at runtime using :func:" -"`get_overloads`." +"Overloaded functions can now be introspected at runtime " +"using :func:`get_overloads`." msgstr "" "Ahora es posible introspectar en tiempo de ejecución las funciones " "sobrecargadas utilizando :func:`get_overloads`." @@ -5183,6 +6308,19 @@ msgid "" "class Other(Leaf): # Error reported by type checker\n" " ..." msgstr "" +"class Base:\n" +" @final\n" +" def done(self) -> None:\n" +" ...\n" +"class Sub(Base):\n" +" def done(self) -> None: # Error informado por el verificador de tipos\n" +" ...\n" +"\n" +"@final\n" +"class Leaf:\n" +" ...\n" +"class Other(Leaf): # Error informado por el verificador de tipos\n" +" ..." #: ../Doc/library/typing.rst:3086 msgid "" @@ -5243,6 +6381,9 @@ msgid "" "No type checker ever added support for ``@no_type_check_decorator``. It is " "therefore deprecated, and will be removed in Python 3.15." msgstr "" +"Ningún verificador de tipos agregó compatibilidad con " +"``@no_type_check_decorator``. Por lo tanto, está obsoleto y se eliminará en " +"Python 3.15." #: ../Doc/library/typing.rst:3120 msgid "" @@ -5278,6 +6419,18 @@ msgid "" " def done(self) -> None: # Error reported by type checker\n" " ..." msgstr "" +"class Base:\n" +" def log_status(self) -> None:\n" +" ...\n" +"\n" +"class Sub(Base):\n" +" @override\n" +" def log_status(self) -> None: # Okay: sobreescribe Base.log_status\n" +" ...\n" +"\n" +" @override\n" +" def done(self) -> None: # Error reportado por el verificador de tipos\n" +" ..." #: ../Doc/library/typing.rst:3145 msgid "There is no runtime checking of this property." @@ -5328,6 +6481,12 @@ msgid "" "\n" "def fetch_response() -> Response: ..." msgstr "" +"@type_check_only\n" +"class Response: # privado o no disponible en tiempo de ejecución\n" +" code: int\n" +" def get_header(self, name: str) -> str: ...\n" +"\n" +"def fetch_response() -> Response: ..." #: ../Doc/library/typing.rst:3174 msgid "" @@ -5354,6 +6513,8 @@ msgid "" "This is often the same as ``obj.__annotations__``, but this function makes " "the following changes to the annotations dictionary:" msgstr "" +"A menudo es lo mismo que ``obj.__annotations__``, pero esta función realiza " +"los siguientes cambios en el diccionario de anotaciones:" #: ../Doc/library/typing.rst:3188 msgid "" @@ -5363,16 +6524,23 @@ msgid "" "*globalns* or *localns* is not given, appropriate namespace dictionaries are " "inferred from *obj*." msgstr "" +"Las referencias futuras codificadas como literales de cadena u " +"objetos :class:`ForwardRef` se manejan evaluándolas en el espacio de nombres " +"*globalns*, *localns* y (cuando corresponda) el espacio de nombre :ref:`type " +"parameter ` *obj*. Si no se proporciona *globalns* o *localns*, " +"los diccionarios de espacios de nombres apropiados se infieren de *obj*." #: ../Doc/library/typing.rst:3193 msgid "``None`` is replaced with :class:`types.NoneType`." -msgstr "" +msgstr "``None`` se reemplaza por :class:`types.NoneType`." #: ../Doc/library/typing.rst:3194 msgid "" "If :func:`@no_type_check ` has been applied to *obj*, an " "empty dictionary is returned." msgstr "" +"Si se ha aplicado :func:`@no_type_check ` a *obj*, se " +"devuelve un diccionario vacío." #: ../Doc/library/typing.rst:3196 msgid "" @@ -5383,32 +6551,45 @@ msgid "" "earlier in the :term:`method resolution order` always take precedence over " "annotations on classes appearing later in the method resolution order." msgstr "" +"Si *obj* es una clase ``C``, la función devuelve un diccionario que fusiona " +"las anotaciones de las clases base de ``C`` con las de ``C`` directamente. " +"Esto se hace recorriendo :attr:`C.__mro__ ` y combinando " +"iterativamente los diccionarios ``__annotations__``. Las anotaciones sobre " +"las clases que aparecen antes en :term:`method resolution order` siempre " +"tienen prioridad sobre las anotaciones sobre las clases que aparecen después " +"en el orden de resolución del método." #: ../Doc/library/typing.rst:3203 -#, fuzzy msgid "" "The function recursively replaces all occurrences of ``Annotated[T, ...]`` " -"with ``T``, unless *include_extras* is set to ``True`` (see :class:" -"`Annotated` for more information)." +"with ``T``, unless *include_extras* is set to ``True`` " +"(see :class:`Annotated` for more information)." msgstr "" -"La función reemplaza recursivamente todos los ``Annotated[T, ...]`` con " -"``T``, a menos que ``include_extras`` esté configurado como ``True`` " -"(consulte :class:`Annotated` para obtener más información). Por ejemplo:" +"La función reemplaza recursivamente todas las apariciones de " +"``Annotated[T, ...]`` con ``T``, a menos que *include_extras* se configure " +"en ``True`` (consulte :class:`Annotated` para obtener más información)." #: ../Doc/library/typing.rst:3207 msgid "" "See also :func:`inspect.get_annotations`, a lower-level function that " "returns annotations more directly." msgstr "" +"Consulte también :func:`inspect.get_annotations`, una función de nivel " +"inferior que devuelve anotaciones de forma más directa." #: ../Doc/library/typing.rst:3212 msgid "" "If any forward references in the annotations of *obj* are not resolvable or " -"are not valid Python code, this function will raise an exception such as :" -"exc:`NameError`. For example, this can happen with imported :ref:`type " +"are not valid Python code, this function will raise an exception such " +"as :exc:`NameError`. For example, this can happen with imported :ref:`type " "aliases ` that include forward references, or with names " "imported under :data:`if TYPE_CHECKING `." msgstr "" +"Si alguna referencia hacia adelante en las anotaciones de *obj* no se puede " +"resolver o no es código Python válido, esta función generará una excepción " +"como :exc:`NameError`. Por ejemplo, esto puede suceder con :ref:`type " +"aliases ` importado que incluye referencias hacia adelante o " +"con nombres importados bajo :data:`if TYPE_CHECKING `." #: ../Doc/library/typing.rst:3218 msgid "" @@ -5439,14 +6620,15 @@ msgstr "" #: ../Doc/library/typing.rst:3232 msgid "" "If ``X`` is a typing-module alias for a builtin or :mod:`collections` class, " -"it will be normalized to the original class. If ``X`` is an instance of :" -"class:`ParamSpecArgs` or :class:`ParamSpecKwargs`, return the underlying :" -"class:`ParamSpec`. Return ``None`` for unsupported objects." +"it will be normalized to the original class. If ``X`` is an instance " +"of :class:`ParamSpecArgs` or :class:`ParamSpecKwargs`, return the " +"underlying :class:`ParamSpec`. Return ``None`` for unsupported objects." msgstr "" -"Si ``X`` es un alias de módulo de tipado para una clase incorporada o :mod:" -"`collections`, se normalizará a la clase original. Si ``X`` es una instancia " -"de :class:`ParamSpecArgs` o :class:`ParamSpecKwargs`, devuelve la :class:" -"`ParamSpec` subyacente. Devuelve ``None`` para objetos no soportados." +"Si ``X`` es un alias de módulo de tipado para una clase incorporada " +"o :mod:`collections`, se normalizará a la clase original. Si ``X`` es una " +"instancia de :class:`ParamSpecArgs` o :class:`ParamSpecKwargs`, devuelve " +"la :class:`ParamSpec` subyacente. Devuelve ``None`` para objetos no " +"soportados." #: ../Doc/library/typing.rst:3238 ../Doc/library/typing.rst:3262 msgid "Examples:" @@ -5462,6 +6644,13 @@ msgid "" "assert get_origin(P.args) is P\n" "assert get_origin(P.kwargs) is P" msgstr "" +"assert get_origin(str) is None\n" +"assert get_origin(Dict[str, int]) is dict\n" +"assert get_origin(Union[int, str]) is Union\n" +"assert get_origin(Annotated[str, \"metadata\"]) is Annotated\n" +"P = ParamSpec('P')\n" +"assert get_origin(P.args) is P\n" +"assert get_origin(P.kwargs) is P" #: ../Doc/library/typing.rst:3254 msgid "" @@ -5489,10 +6678,13 @@ msgid "" "assert get_args(Dict[int, str]) == (int, str)\n" "assert get_args(Union[int, str]) == (int, str)" msgstr "" +"assert get_args(int) == ()\n" +"assert get_args(Dict[int, str]) == (int, str)\n" +"assert get_args(Union[int, str]) == (int, str)" #: ../Doc/library/typing.rst:3274 msgid "Return the set of members defined in a :class:`Protocol`." -msgstr "" +msgstr "Devuelve el conjunto de miembros definidos en un :class:`Protocol`." #: ../Doc/library/typing.rst:3276 msgid "" @@ -5503,13 +6695,18 @@ msgid "" ">>> get_protocol_members(P) == frozenset({'a', 'b'})\n" "True" msgstr "" +">>> from typing import Protocol, get_protocol_members\n" +">>> class P(Protocol):\n" +"... def a(self) -> str: ...\n" +"... b: int\n" +">>> get_protocol_members(P) == frozenset({'a', 'b'})\n" +"True" #: ../Doc/library/typing.rst:3285 msgid "Raise :exc:`TypeError` for arguments that are not Protocols." -msgstr "" +msgstr "Genera :exc:`TypeError` para argumentos que no sean protocolos." #: ../Doc/library/typing.rst:3291 -#, fuzzy msgid "Determine if a type is a :class:`Protocol`." msgstr "Compruebe si un tipo es :class:`TypedDict`." @@ -5522,6 +6719,12 @@ msgid "" "is_protocol(P) # => True\n" "is_protocol(int) # => False" msgstr "" +"class P(Protocol):\n" +" def a(self) -> str: ...\n" +" b: int\n" +"\n" +"is_protocol(P) # => True\n" +"is_protocol(int) # => False" #: ../Doc/library/typing.rst:3306 msgid "Check if a type is a :class:`TypedDict`." @@ -5540,6 +6743,16 @@ msgid "" "# not a typed dict itself\n" "assert not is_typeddict(TypedDict)" msgstr "" +"class Film(TypedDict):\n" +" title: str\n" +" year: int\n" +"\n" +"assert is_typeddict(Film)\n" +"assert not is_typeddict(list | str)\n" +"\n" +"# TypedDict es una fábrica para crear diccionarios tipados,\n" +"# no un diccionario tipado en si mismo\n" +"assert not is_typeddict(TypedDict)" #: ../Doc/library/typing.rst:3327 msgid "" @@ -5573,6 +6786,8 @@ msgid "" "A sentinel object used to indicate that a type parameter has no default " "value. For example:" msgstr "" +"Un objeto centinela que se utiliza para indicar que un parámetro de tipo no " +"tiene un valor predeterminado. Por ejemplo:" #: ../Doc/library/typing.rst:3345 msgid "" @@ -5583,6 +6798,12 @@ msgid "" ">>> S.__default__ is None\n" "True" msgstr "" +">>> T = TypeVar(\"T\")\n" +">>> T.__default__ is typing.NoDefault\n" +"True\n" +">>> S = TypeVar(\"S\", default=None)\n" +">>> S.__default__ is None\n" +"True" #: ../Doc/library/typing.rst:3357 msgid "Constant" @@ -5604,6 +6825,11 @@ msgid "" "def fun(arg: 'expensive_mod.SomeType') -> None:\n" " local_var: expensive_mod.AnotherType = other_fun()" msgstr "" +"if TYPE_CHECKING:\n" +" import expensive_mod\n" +"\n" +"def fun(arg: 'expensive_mod.SomeType') -> None:\n" +" local_var: expensive_mod.AnotherType = other_fun()" #: ../Doc/library/typing.rst:3372 msgid "" @@ -5646,8 +6872,8 @@ msgstr "" "preexistentes. Originalmente, se incluyeron en el módulo de tipado para " "admitir la parametrización de estas clases genéricas mediante ``[]``. Sin " "embargo, los alias se volvieron redundantes en Python 3.9 cuando las clases " -"preexistentes correspondientes se mejoraron para admitir ``[]`` (vea :pep:" -"`585`)." +"preexistentes correspondientes se mejoraron para admitir ``[]`` " +"(vea :pep:`585`)." #: ../Doc/library/typing.rst:3400 msgid "" @@ -5691,70 +6917,68 @@ msgid "Deprecated alias to :class:`dict`." msgstr "Alias obsoleto de :class:`dict`." #: ../Doc/library/typing.rst:3422 -#, fuzzy msgid "" "Note that to annotate arguments, it is preferred to use an abstract " "collection type such as :class:`~collections.abc.Mapping` rather than to " "use :class:`dict` or :class:`!typing.Dict`." msgstr "" -"Tenga en cuenta que para anotar argumentos, es preferible utilizar un tipo " -"de colección abstracto como :class:`Mapping` en lugar de utilizar :class:" -"`dict` o :class:`!typing.Dict`." +"Tenga en cuenta que para anotar argumentos, se prefiere utilizar un tipo de " +"colección abstracto como :class:`~collections.abc.Mapping` en lugar de " +"utilizar :class:`dict` o :class:`!typing.Dict`." #: ../Doc/library/typing.rst:3426 msgid "" -":class:`builtins.dict ` now supports subscripting (``[]``). See :pep:" -"`585` and :ref:`types-genericalias`." +":class:`builtins.dict ` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -":class:`builtins.dict ` ahora soporta subíndices (``[]``). Véase :pep:" -"`585` y :ref:`types-genericalias`." +":class:`builtins.dict ` ahora soporta subíndices (``[]``). " +"Véase :pep:`585` y :ref:`types-genericalias`." #: ../Doc/library/typing.rst:3432 msgid "Deprecated alias to :class:`list`." msgstr "Alias obsoleto de :class:`list`." #: ../Doc/library/typing.rst:3434 -#, fuzzy msgid "" "Note that to annotate arguments, it is preferred to use an abstract " -"collection type such as :class:`~collections.abc.Sequence` or :class:" -"`~collections.abc.Iterable` rather than to use :class:`list` or :class:`!" -"typing.List`." +"collection type such as :class:`~collections.abc.Sequence` " +"or :class:`~collections.abc.Iterable` rather than to use :class:`list` " +"or :class:`!typing.List`." msgstr "" -"Tenga en cuenta que para anotar argumentos, es preferible utilizar un tipo " -"de colección abstracto como :class:`Sequence` o :class:`Iterable` en lugar " -"de utilizar :class:`list` o :class:`!typing.List`." +"Tenga en cuenta que para anotar argumentos, se prefiere utilizar un tipo de " +"colección abstracto como :class:`~collections.abc.Sequence` " +"o :class:`~collections.abc.Iterable` en lugar de utilizar :class:`list` " +"o :class:`!typing.List`." #: ../Doc/library/typing.rst:3439 msgid "" -":class:`builtins.list ` now supports subscripting (``[]``). See :pep:" -"`585` and :ref:`types-genericalias`." +":class:`builtins.list ` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -":class:`builtins.list ` ahora soporta subíndices (``[]``). Véase :pep:" -"`585` y :ref:`types-genericalias`." +":class:`builtins.list ` ahora soporta subíndices (``[]``). " +"Véase :pep:`585` y :ref:`types-genericalias`." #: ../Doc/library/typing.rst:3445 msgid "Deprecated alias to :class:`builtins.set `." msgstr "Alias obsoleto de :class:`builtins.set `." #: ../Doc/library/typing.rst:3447 -#, fuzzy msgid "" "Note that to annotate arguments, it is preferred to use an abstract " -"collection type such as :class:`collections.abc.Set` rather than to use :" -"class:`set` or :class:`typing.Set`." +"collection type such as :class:`collections.abc.Set` rather than to " +"use :class:`set` or :class:`typing.Set`." msgstr "" -"Tenga en cuenta que para anotar argumentos, es preferible utilizar un tipo " -"de colección abstracto como :class:`AbstractSet` en lugar de utilizar :class:" -"`set` o :class:`!typing.Set`." +"Tenga en cuenta que para anotar argumentos, se prefiere utilizar un tipo de " +"colección abstracto como :class:`collections.abc.Set` en lugar de " +"utilizar :class:`set` o :class:`typing.Set`." #: ../Doc/library/typing.rst:3451 msgid "" -":class:`builtins.set ` now supports subscripting (``[]``). See :pep:" -"`585` and :ref:`types-genericalias`." +":class:`builtins.set ` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -":class:`builtins.set ` ahora soporta subíndices (``[]``). Véase :pep:" -"`585` y :ref:`types-genericalias`." +":class:`builtins.set ` ahora soporta subíndices (``[]``). " +"Véase :pep:`585` y :ref:`types-genericalias`." #: ../Doc/library/typing.rst:3457 msgid "Deprecated alias to :class:`builtins.frozenset `." @@ -5774,16 +6998,16 @@ msgstr "Alias obsoleto de :class:`tuple`." #: ../Doc/library/typing.rst:3468 msgid "" -":class:`tuple` and ``Tuple`` are special-cased in the type system; see :ref:" -"`annotating-tuples` for more details." +":class:`tuple` and ``Tuple`` are special-cased in the type system; " +"see :ref:`annotating-tuples` for more details." msgstr "" ":class:`tuple` y ``Tuple`` son casos especiales en el sistema de tipos; " "consulte :ref:`annotating-tuples` para más detalles." #: ../Doc/library/typing.rst:3471 msgid "" -":class:`builtins.tuple ` now supports subscripting (``[]``). See :pep:" -"`585` and :ref:`types-genericalias`." +":class:`builtins.tuple ` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" ":class:`builtins.tuple ` ahora soporta el uso de subíndices (``[]``). " "Véase :pep:`585` y :ref:`types-genericalias`." @@ -5797,13 +7021,13 @@ msgid "" "See :ref:`type-of-class-objects` for details on using :class:`type` or " "``typing.Type`` in type annotations." msgstr "" -"Vea :ref:`type-of-class-objects` para obtener detalles sobre el uso de :" -"class:`type` o ``typing.Type`` en anotaciones de tipo." +"Vea :ref:`type-of-class-objects` para obtener detalles sobre el uso " +"de :class:`type` o ``typing.Type`` en anotaciones de tipo." #: ../Doc/library/typing.rst:3484 msgid "" -":class:`builtins.type ` now supports subscripting (``[]``). See :pep:" -"`585` and :ref:`types-genericalias`." +":class:`builtins.type ` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" ":class:`builtins.type ` ahora soporta el uso de subíndices (``[]``). " "Véase :pep:`585` y :ref:`types-genericalias`." @@ -5818,11 +7042,11 @@ msgstr "Alias obsoleto de :class:`collections.defaultdict`." #: ../Doc/library/typing.rst:3499 msgid "" -":class:`collections.defaultdict` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.defaultdict` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -":class:`collections.defaultdict` ahora soporta subíndices (``[]``). Véase :" -"pep:`585` y :ref:`types-genericalias`." +":class:`collections.defaultdict` ahora soporta subíndices (``[]``). " +"Véase :pep:`585` y :ref:`types-genericalias`." #: ../Doc/library/typing.rst:3505 msgid "Deprecated alias to :class:`collections.OrderedDict`." @@ -5830,11 +7054,11 @@ msgstr "Alias obsoleto de :class:`collections.OrderedDict`." #: ../Doc/library/typing.rst:3509 msgid "" -":class:`collections.OrderedDict` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.OrderedDict` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -":class:`collections.OrderedDict` ahora soporta subíndices (``[]``). Véase :" -"pep:`585` y :ref:`types-genericalias`." +":class:`collections.OrderedDict` ahora soporta subíndices (``[]``). " +"Véase :pep:`585` y :ref:`types-genericalias`." #: ../Doc/library/typing.rst:3515 msgid "Deprecated alias to :class:`collections.ChainMap`." @@ -5842,11 +7066,11 @@ msgstr "Alias obsoleto de :class:`collections.ChainMap`." #: ../Doc/library/typing.rst:3519 msgid "" -":class:`collections.ChainMap` now supports subscripting (``[]``). See :pep:" -"`585` and :ref:`types-genericalias`." +":class:`collections.ChainMap` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -":class:`collections.ChainMap` ahora soporta subíndices (``[]``). Véase :pep:" -"`585` y :ref:`types-genericalias`." +":class:`collections.ChainMap` ahora soporta subíndices (``[]``). " +"Véase :pep:`585` y :ref:`types-genericalias`." #: ../Doc/library/typing.rst:3525 msgid "Deprecated alias to :class:`collections.Counter`." @@ -5854,11 +7078,11 @@ msgstr "Alias obsoleto de :class:`collections.Counter`." #: ../Doc/library/typing.rst:3529 msgid "" -":class:`collections.Counter` now supports subscripting (``[]``). See :pep:" -"`585` and :ref:`types-genericalias`." +":class:`collections.Counter` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -":class:`collections.Counter` ahora soporta subíndices (``[]``)`. Véase :pep:" -"`585` y :ref:`types-genericalias`." +":class:`collections.Counter` ahora soporta subíndices (``[]``)`. " +"Véase :pep:`585` y :ref:`types-genericalias`." #: ../Doc/library/typing.rst:3535 msgid "Deprecated alias to :class:`collections.deque`." @@ -5866,11 +7090,11 @@ msgstr "Alias obsoleto de :class:`collections.deque`." #: ../Doc/library/typing.rst:3539 msgid "" -":class:`collections.deque` now supports subscripting (``[]``). See :pep:" -"`585` and :ref:`types-genericalias`." +":class:`collections.deque` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -":class:`collections.deque` ahora soporta subíndices (``[]``). Véase :pep:" -"`585` y :ref:`types-genericalias`." +":class:`collections.deque` ahora soporta subíndices (``[]``). " +"Véase :pep:`585` y :ref:`types-genericalias`." #: ../Doc/library/typing.rst:3546 msgid "Aliases to other concrete types" @@ -5886,20 +7110,20 @@ msgstr "" #: ../Doc/library/typing.rst:3554 msgid "" -"These types (and the corresponding functions) are generic over :data:" -"`AnyStr`. ``Pattern`` can be specialised as ``Pattern[str]`` or " +"These types (and the corresponding functions) are generic " +"over :data:`AnyStr`. ``Pattern`` can be specialised as ``Pattern[str]`` or " "``Pattern[bytes]``; ``Match`` can be specialised as ``Match[str]`` or " "``Match[bytes]``." msgstr "" -"Estos tipos (y las funciones correspondientes) son genéricos sobre :data:" -"`AnyStr`. ``Pattern`` se puede especializar como ``Pattern[str]`` o " -"``Pattern[bytes]``; ``Match`` se puede especializar como ``Match[str]`` o " -"``Match[bytes]``." +"Estos tipos (y las funciones correspondientes) son genéricos " +"sobre :data:`AnyStr`. ``Pattern`` se puede especializar como " +"``Pattern[str]`` o ``Pattern[bytes]``; ``Match`` se puede especializar como " +"``Match[str]`` o ``Match[bytes]``." #: ../Doc/library/typing.rst:3559 msgid "" -"Classes ``Pattern`` and ``Match`` from :mod:`re` now support ``[]``. See :" -"pep:`585` and :ref:`types-genericalias`." +"Classes ``Pattern`` and ``Match`` from :mod:`re` now support ``[]``. " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" "Las clases ``Pattern`` y ``Match`` de :mod:`re` ahora soportan ``[]``. " "Véase :pep:`585` y :ref:`types-genericalias`." @@ -5929,6 +7153,8 @@ msgid "" "def add_unicode_checkmark(text: Text) -> Text:\n" " return text + u' \\u2713'" msgstr "" +"def add_unicode_checkmark(text: Text) -> Text:\n" +" return text + u' \\u2713'" #: ../Doc/library/typing.rst:3579 msgid "" @@ -5951,19 +7177,19 @@ msgstr "Alias obsoleto de :class:`collections.abc.Set`." #: ../Doc/library/typing.rst:3595 msgid "" -":class:`collections.abc.Set` now supports subscripting (``[]``). See :pep:" -"`585` and :ref:`types-genericalias`." +":class:`collections.abc.Set` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -":class:`collections.abc.Set` ahora soporta subíndices (``[]``). Véase :pep:" -"`585` y :ref:`types-genericalias`." +":class:`collections.abc.Set` ahora soporta subíndices (``[]``). " +"Véase :pep:`585` y :ref:`types-genericalias`." #: ../Doc/library/typing.rst:3601 msgid "" -"This type represents the types :class:`bytes`, :class:`bytearray`, and :" -"class:`memoryview` of byte sequences." +"This type represents the types :class:`bytes`, :class:`bytearray`, " +"and :class:`memoryview` of byte sequences." msgstr "" -"Este tipo representa a los tipos :class:`bytes`, :class:`bytearray`, y :" -"class:`memoryview` de secuencias de bytes." +"Este tipo representa a los tipos :class:`bytes`, :class:`bytearray`, " +"y :class:`memoryview` de secuencias de bytes." #: ../Doc/library/typing.rst:3604 msgid "" @@ -5979,8 +7205,8 @@ msgstr "Alias obsoleto de :class:`collections.abc.Collection`." #: ../Doc/library/typing.rst:3613 msgid "" -":class:`collections.abc.Collection` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Collection` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" ":class:`collections.abc.Collection` ahora soporta la sintaxis de subíndice " "(``[]``). Véase :pep:`585` y :ref:`types-genericalias`." @@ -5991,11 +7217,11 @@ msgstr "Alias obsoleto de :class:`collections.abc.Container`." #: ../Doc/library/typing.rst:3621 msgid "" -":class:`collections.abc.Container` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Container` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -":class:`collections.abc.Container` ahora soporta subíndices (``[]``). Véase :" -"pep:`585` y :ref:`types-genericalias`." +":class:`collections.abc.Container` ahora soporta subíndices (``[]``). " +"Véase :pep:`585` y :ref:`types-genericalias`." #: ../Doc/library/typing.rst:3627 msgid "Deprecated alias to :class:`collections.abc.ItemsView`." @@ -6003,11 +7229,11 @@ msgstr "Alias obsoleto de :class:`collections.abc.ItemsView`." #: ../Doc/library/typing.rst:3629 msgid "" -":class:`collections.abc.ItemsView` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.ItemsView` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -":class:`collections.abc.ItemsView` ahora soporta subíndices (``[]``). Véase :" -"pep:`585` y :ref:`types-genericalias`." +":class:`collections.abc.ItemsView` ahora soporta subíndices (``[]``). " +"Véase :pep:`585` y :ref:`types-genericalias`." #: ../Doc/library/typing.rst:3635 msgid "Deprecated alias to :class:`collections.abc.KeysView`." @@ -6015,11 +7241,11 @@ msgstr "Alias obsoleto de :class:`collections.abc.KeysView`." #: ../Doc/library/typing.rst:3637 msgid "" -":class:`collections.abc.KeysView` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.KeysView` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -":class:`collections.abc.KeysView` ahora soporta subíndices (``[]``). Véase :" -"pep:`585` y :ref:`types-genericalias`." +":class:`collections.abc.KeysView` ahora soporta subíndices (``[]``). " +"Véase :pep:`585` y :ref:`types-genericalias`." #: ../Doc/library/typing.rst:3643 msgid "Deprecated alias to :class:`collections.abc.Mapping`." @@ -6027,11 +7253,11 @@ msgstr "Alias obsoleto de :class:`collections.abc.Mapping`." #: ../Doc/library/typing.rst:3645 msgid "" -":class:`collections.abc.Mapping` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Mapping` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -":class:`collections.abc.Mapping` ahora soporta subíndices (``[]``). Véase :" -"pep:`585` y :ref:`types-genericalias`." +":class:`collections.abc.Mapping` ahora soporta subíndices (``[]``). " +"Véase :pep:`585` y :ref:`types-genericalias`." #: ../Doc/library/typing.rst:3651 msgid "Deprecated alias to :class:`collections.abc.MappingView`." @@ -6075,8 +7301,8 @@ msgstr "Alias obsoleto de :class:`collections.abc.MutableSet`." #: ../Doc/library/typing.rst:3679 msgid "" -":class:`collections.abc.MutableSet` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.MutableSet` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" ":class:`collections.abc.MutableSet` ahora soporta subíndices (``[]``). " "Véase :pep:`585` y :ref:`types-genericalias`." @@ -6087,11 +7313,11 @@ msgstr "Alias obsoleto de :class:`collections.abc.Sequence`." #: ../Doc/library/typing.rst:3687 msgid "" -":class:`collections.abc.Sequence` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Sequence` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -":class:`collections.abc.Sequence` ahora soporta subíndices (``[]``). Véase :" -"pep:`585` y :ref:`types-genericalias`." +":class:`collections.abc.Sequence` ahora soporta subíndices (``[]``). " +"Véase :pep:`585` y :ref:`types-genericalias`." #: ../Doc/library/typing.rst:3693 msgid "Deprecated alias to :class:`collections.abc.ValuesView`." @@ -6099,8 +7325,8 @@ msgstr "Alias obsoleto de :class:`collections.abc.ValuesView`." #: ../Doc/library/typing.rst:3695 msgid "" -":class:`collections.abc.ValuesView` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.ValuesView` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" ":class:`collections.abc.ValuesView` ahora soporta subíndices (``[]``). " "Véase :pep:`585` y :ref:`types-genericalias`." @@ -6114,37 +7340,36 @@ msgid "Deprecated alias to :class:`collections.abc.Coroutine`." msgstr "Alias obsoleto de :class:`collections.abc.Coroutine`." #: ../Doc/library/typing.rst:3708 -#, fuzzy msgid "" -"See :ref:`annotating-generators-and-coroutines` for details on using :class:" -"`collections.abc.Coroutine` and ``typing.Coroutine`` in type annotations." +"See :ref:`annotating-generators-and-coroutines` for details on " +"using :class:`collections.abc.Coroutine` and ``typing.Coroutine`` in type " +"annotations." msgstr "" -"Vea :ref:`annotating-callables` para información detallada de cómo usar :" -"class:`collections.abc.Callable` y ``typing.Callable`` en anotaciones de " -"tipo." +"Consulte :ref:`annotating-generators-and-coroutines` para obtener detalles " +"sobre el uso de :class:`collections.abc.Coroutine` y ``typing.Coroutine`` en " +"anotaciones de tipo." #: ../Doc/library/typing.rst:3714 msgid "" -":class:`collections.abc.Coroutine` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Coroutine` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -":class:`collections.abc.Coroutine` ahora soporta subíndices (``[]``). Véase :" -"pep:`585` y :ref:`types-genericalias`." +":class:`collections.abc.Coroutine` ahora soporta subíndices (``[]``). " +"Véase :pep:`585` y :ref:`types-genericalias`." #: ../Doc/library/typing.rst:3720 msgid "Deprecated alias to :class:`collections.abc.AsyncGenerator`." msgstr "Alias obsoleto de :class:`collections.abc.AsyncGenerator`." #: ../Doc/library/typing.rst:3722 -#, fuzzy msgid "" -"See :ref:`annotating-generators-and-coroutines` for details on using :class:" -"`collections.abc.AsyncGenerator` and ``typing.AsyncGenerator`` in type " -"annotations." +"See :ref:`annotating-generators-and-coroutines` for details on " +"using :class:`collections.abc.AsyncGenerator` and ``typing.AsyncGenerator`` " +"in type annotations." msgstr "" -"Vea :ref:`annotating-callables` para información detallada de cómo usar :" -"class:`collections.abc.Callable` y ``typing.Callable`` en anotaciones de " -"tipo." +"Consulte :ref:`annotating-generators-and-coroutines` para obtener detalles " +"sobre el uso de :class:`collections.abc.AsyncGenerator` y " +"``typing.AsyncGenerator`` en anotaciones de tipo." #: ../Doc/library/typing.rst:3728 msgid "" @@ -6156,7 +7381,7 @@ msgstr "" #: ../Doc/library/typing.rst:3733 msgid "The ``SendType`` parameter now has a default." -msgstr "" +msgstr "El parámetro ``SendType`` ahora tiene un valor predeterminado." #: ../Doc/library/typing.rst:3738 msgid "Deprecated alias to :class:`collections.abc.AsyncIterable`." @@ -6188,11 +7413,11 @@ msgstr "Alias obsoleto de :class:`collections.abc.Awaitable`." #: ../Doc/library/typing.rst:3762 msgid "" -":class:`collections.abc.Awaitable` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Awaitable` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -":class:`collections.abc.Awaitable` ahora soporta subíndices (``[]``). Véase :" -"pep:`585` y :ref:`types-genericalias`." +":class:`collections.abc.Awaitable` ahora soporta subíndices (``[]``). " +"Véase :pep:`585` y :ref:`types-genericalias`." #: ../Doc/library/typing.rst:3769 msgid "Aliases to other ABCs in :mod:`collections.abc`" @@ -6204,11 +7429,11 @@ msgstr "Alias obsoleto de :class:`collections.abc.Iterable`." #: ../Doc/library/typing.rst:3775 msgid "" -":class:`collections.abc.Iterable` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Iterable` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -":class:`collections.abc.Iterable` ahora soporta subíndices (``[]``). Véase :" -"pep:`585` y :ref:`types-genericalias`." +":class:`collections.abc.Iterable` ahora soporta subíndices (``[]``). " +"Véase :pep:`585` y :ref:`types-genericalias`." #: ../Doc/library/typing.rst:3781 msgid "Deprecated alias to :class:`collections.abc.Iterator`." @@ -6216,11 +7441,11 @@ msgstr "Alias obsoleto de :class:`collections.abc.Iterator`." #: ../Doc/library/typing.rst:3783 msgid "" -":class:`collections.abc.Iterator` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Iterator` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -":class:`collections.abc.Iterator` ahora soporta subíndices (``[]``). Véase :" -"pep:`585` y :ref:`types-genericalias`." +":class:`collections.abc.Iterator` ahora soporta subíndices (``[]``). " +"Véase :pep:`585` y :ref:`types-genericalias`." #: ../Doc/library/typing.rst:3789 msgid "Deprecated alias to :class:`collections.abc.Callable`." @@ -6228,46 +7453,47 @@ msgstr "Alias obsoleto de :class:`collections.abc.Callable`." #: ../Doc/library/typing.rst:3791 msgid "" -"See :ref:`annotating-callables` for details on how to use :class:" -"`collections.abc.Callable` and ``typing.Callable`` in type annotations." +"See :ref:`annotating-callables` for details on how to " +"use :class:`collections.abc.Callable` and ``typing.Callable`` in type " +"annotations." msgstr "" -"Vea :ref:`annotating-callables` para información detallada de cómo usar :" -"class:`collections.abc.Callable` y ``typing.Callable`` en anotaciones de " -"tipo." +"Vea :ref:`annotating-callables` para información detallada de cómo " +"usar :class:`collections.abc.Callable` y ``typing.Callable`` en anotaciones " +"de tipo." #: ../Doc/library/typing.rst:3794 msgid "" -":class:`collections.abc.Callable` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Callable` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -":class:`collections.abc.Callable` ahora soporta subíndices (``[]``). Véase :" -"pep:`585` y :ref:`types-genericalias`." +":class:`collections.abc.Callable` ahora soporta subíndices (``[]``). " +"Véase :pep:`585` y :ref:`types-genericalias`." #: ../Doc/library/typing.rst:3804 msgid "Deprecated alias to :class:`collections.abc.Generator`." msgstr "Alias obsoleto de :class:`collections.abc.Generator`." #: ../Doc/library/typing.rst:3806 -#, fuzzy msgid "" -"See :ref:`annotating-generators-and-coroutines` for details on using :class:" -"`collections.abc.Generator` and ``typing.Generator`` in type annotations." +"See :ref:`annotating-generators-and-coroutines` for details on " +"using :class:`collections.abc.Generator` and ``typing.Generator`` in type " +"annotations." msgstr "" -"Vea :ref:`annotating-callables` para información detallada de cómo usar :" -"class:`collections.abc.Callable` y ``typing.Callable`` en anotaciones de " -"tipo." +"Consulte :ref:`annotating-generators-and-coroutines` para obtener detalles " +"sobre el uso de :class:`collections.abc.Generator` y ``typing.Generator`` en " +"anotaciones de tipo." #: ../Doc/library/typing.rst:3810 msgid "" -":class:`collections.abc.Generator` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Generator` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -":class:`collections.abc.Generator` ahora soporta subíndices (``[]``). Véase :" -"pep:`585` y :ref:`types-genericalias`." +":class:`collections.abc.Generator` ahora soporta subíndices (``[]``). " +"Véase :pep:`585` y :ref:`types-genericalias`." #: ../Doc/library/typing.rst:3814 msgid "Default values for the send and return types were added." -msgstr "" +msgstr "Valores por defecto para los tipos send y return fueron agregados." #: ../Doc/library/typing.rst:3819 msgid "Deprecated alias to :class:`collections.abc.Hashable`." @@ -6283,8 +7509,8 @@ msgstr "Alias obsoleto de :class:`collections.abc.Reversible`." #: ../Doc/library/typing.rst:3828 msgid "" -":class:`collections.abc.Reversible` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Reversible` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" ":class:`collections.abc.Reversible` ahora soporta subíndices (``[]``). " "Véase :pep:`585` y :ref:`types-genericalias`." @@ -6307,11 +7533,15 @@ msgstr "Alias obsoleto de :class:`contextlib.AbstractContextManager`." #: ../Doc/library/typing.rst:3848 msgid "" -"The first type parameter, ``T_co``, represents the type returned by the :" -"meth:`~object.__enter__` method. The optional second type parameter, " +"The first type parameter, ``T_co``, represents the type returned by " +"the :meth:`~object.__enter__` method. The optional second type parameter, " "``ExitT_co``, which defaults to ``bool | None``, represents the type " "returned by the :meth:`~object.__exit__` method." msgstr "" +"El primer parámetro de tipo, ``T_co``, representa el tipo devuelto por el " +"método :meth:`~object.__enter__`. El segundo parámetro de tipo opcional, " +"``ExitT_co``, cuyo valor predeterminado es ``bool | None``, representa el " +"tipo devuelto por el método :meth:`~object.__exit__`." #: ../Doc/library/typing.rst:3855 msgid "" @@ -6323,7 +7553,7 @@ msgstr "" #: ../Doc/library/typing.rst:3860 msgid "Added the optional second type parameter, ``ExitT_co``." -msgstr "" +msgstr "Se agregó el segundo parámetro de tipo opcional, ``ExitT_co``." #: ../Doc/library/typing.rst:3865 msgid "Deprecated alias to :class:`contextlib.AbstractAsyncContextManager`." @@ -6331,11 +7561,15 @@ msgstr "Alias obsoleto de :class:`contextlib.AbstractAsyncContextManager`." #: ../Doc/library/typing.rst:3867 msgid "" -"The first type parameter, ``T_co``, represents the type returned by the :" -"meth:`~object.__aenter__` method. The optional second type parameter, " +"The first type parameter, ``T_co``, represents the type returned by " +"the :meth:`~object.__aenter__` method. The optional second type parameter, " "``AExitT_co``, which defaults to ``bool | None``, represents the type " "returned by the :meth:`~object.__aexit__` method." msgstr "" +"El primer parámetro de tipo, ``T_co``, representa el tipo devuelto por el " +"método :meth:`~object.__aenter__`. El segundo parámetro de tipo opcional, " +"``AExitT_co``, cuyo valor predeterminado es ``bool | None``, representa el " +"tipo devuelto por el método :meth:`~object.__aexit__`." #: ../Doc/library/typing.rst:3874 msgid "" @@ -6347,7 +7581,7 @@ msgstr "" #: ../Doc/library/typing.rst:3879 msgid "Added the optional second type parameter, ``AExitT_co``." -msgstr "" +msgstr "Se agregó el segundo parámetro de tipo opcional, ``AExitT_co``." #: ../Doc/library/typing.rst:3883 msgid "Deprecation Timeline of Major Features" @@ -6448,33 +7682,28 @@ msgstr ":pep:`695`" #: ../Doc/library/typing.rst:3916 msgid ":func:`@typing.no_type_check_decorator `" -msgstr "" +msgstr ":func:`@typing.no_type_check_decorator `" #: ../Doc/library/typing.rst:3917 ../Doc/library/typing.rst:3921 msgid "3.13" msgstr "3.13" #: ../Doc/library/typing.rst:3918 -#, fuzzy msgid "3.15" -msgstr "3.14" +msgstr "3.15" #: ../Doc/library/typing.rst:3919 -#, fuzzy msgid ":gh:`106309`" -msgstr ":gh:`94309`" +msgstr ":gh:`106309`" #: ../Doc/library/typing.rst:3920 -#, fuzzy msgid ":data:`typing.AnyStr`" -msgstr ":data:`typing.Text`" +msgstr ":data:`typing.AnyStr`" #: ../Doc/library/typing.rst:3922 -#, fuzzy msgid "3.18" -msgstr "3.8" +msgstr "3.18" #: ../Doc/library/typing.rst:3923 -#, fuzzy msgid ":gh:`105578`" -msgstr ":gh:`91896`" +msgstr ":gh:`105578`"