diff --git a/faq/extending.po b/faq/extending.po index 6b00e29806..97b12e4225 100644 --- a/faq/extending.po +++ b/faq/extending.po @@ -6,31 +6,33 @@ # Check https://github.com/PyCampES/python-docs-es/blob/3.8/TRANSLATORS to # get the list of volunteers # -#, fuzzy msgid "" msgstr "" "Project-Id-Version: Python 3.8\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-05-05 12:54+0200\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" +"PO-Revision-Date: 2020-08-10 07:54-0300\n" "Language-Team: python-doc-es\n" "MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=utf-8\n" +"Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Generated-By: Babel 2.8.0\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Last-Translator: \n" +"Language: es_AR\n" +"X-Generator: Poedit 2.4\n" #: ../Doc/faq/extending.rst:3 msgid "Extending/Embedding FAQ" -msgstr "" +msgstr "Extendiendo/Embebiendo FAQ" #: ../Doc/faq/extending.rst:6 msgid "Contents" -msgstr "" +msgstr "Contenidos" #: ../Doc/faq/extending.rst:16 msgid "Can I create my own functions in C?" -msgstr "" +msgstr "¿Puedo crear mis propias funciones en C?" #: ../Doc/faq/extending.rst:18 msgid "" @@ -38,14 +40,19 @@ msgid "" "exceptions and even new types in C. This is explained in the document :ref:" "`extending-index`." msgstr "" +"Si, puedes crear módulos incorporados que contengan funciones, variables, " +"excepciones y incluso nuevos tipos en C. Esto esta explicado en el " +"documento :ref:`extending-index`." #: ../Doc/faq/extending.rst:22 msgid "Most intermediate or advanced Python books will also cover this topic." msgstr "" +"La mayoría de los libros intermedios o avanzados de Python también tratan " +"este tema." #: ../Doc/faq/extending.rst:26 msgid "Can I create my own functions in C++?" -msgstr "" +msgstr "¿Puedo crear mis propias funciones en C++?" #: ../Doc/faq/extending.rst:28 msgid "" @@ -54,16 +61,23 @@ msgid "" "each function that is going to be called by the Python interpreter. Global " "or static C++ objects with constructors are probably not a good idea." msgstr "" +"Si, utilizando las características de compatibilidad encontradas en C++. " +"Coloca ``extern \"C\" { ... }`` alrededor los archivos incluidos Python y " +"pon ``extern \"C\"`` antes de cada función que será llamada por el " +"interprete Python. Objetos globales o estáticos C++ con constructores no son " +"una buena idea seguramente." #: ../Doc/faq/extending.rst:37 msgid "Writing C is hard; are there any alternatives?" -msgstr "" +msgstr "Escribir en C es difícil; ¿no hay otra alternativa?" #: ../Doc/faq/extending.rst:39 msgid "" "There are a number of alternatives to writing your own C extensions, " "depending on what you're trying to do." msgstr "" +"Hay un número de alternativas a escribir tus propias extensiones C, " +"dependiendo en que estés tratando de hacer." #: ../Doc/faq/extending.rst:44 msgid "" @@ -73,6 +87,11 @@ msgid "" "Cython and Pyrex make it possible to write an extension without having to " "learn Python's C API." msgstr "" +"`Cython `_ y su relativo `Pyrex `_ son compiladores que aceptan " +"una forma de Python ligeramente modificada y generan el código C " +"correspondiente. Cython y *Pyrex* hacen posible escribir una extensión sin " +"tener que aprender la API de Python C." #: ../Doc/faq/extending.rst:50 msgid "" @@ -84,10 +103,17 @@ msgid "" "html>`_, or `Weave `_ are also alternatives " "for wrapping C++ libraries." msgstr "" +"Si necesitas hacer una interfaz a alguna biblioteca C o C++ que no posee aún " +"extensión Python, puedes intentar empaquetar los tipo de datos de la " +"biblioteca con una herramienta como `SWIG `_. `SIP " +"`__, `CXX `_ `Boost `_, o `Weave `_ también son " +"alternativas para empaquetar bibliotecas C++." #: ../Doc/faq/extending.rst:61 msgid "How can I execute arbitrary Python statements from C?" -msgstr "" +msgstr "¿Cómo puedo ejecutar declaraciones arbitrarias de Python desde C?" #: ../Doc/faq/extending.rst:63 msgid "" @@ -98,21 +124,31 @@ msgid "" "func:`PyRun_String`; see the source for :c:func:`PyRun_SimpleString` in " "``Python/pythonrun.c``." msgstr "" +"La función de más alto nivel para hacer esto es :c:func:`PyRun_SimpleString` " +"que toma un solo argumento de cadena de caracteres para ser ejecutado en el " +"contexto del módulo ``__main__`` y retorna ``0`` si tiene éxito y ``-1`` " +"cuando ocurre una excepción (incluyendo :exc:`SyntaxError`). Si quieres mas " +"control, usa :c:func:`PyRun_String`; mira la fuente para :c:func:" +"`PyRun_SimpleString` en ``Python/pythonrun.c``." #: ../Doc/faq/extending.rst:72 msgid "How can I evaluate an arbitrary Python expression from C?" -msgstr "" +msgstr "¿Cómo puedo evaluar una expresión arbitraria de Python desde C?" #: ../Doc/faq/extending.rst:74 +#, fuzzy msgid "" "Call the function :c:func:`PyRun_String` from the previous question with the " "start symbol :c:data:`Py_eval_input`; it parses an expression, evaluates it " "and returns its value." msgstr "" +"Llama a la función :c:func:`PyRun_String` de la pregunta anterior con el " +"símbolo de comienzo (*start*) :c:data:`Py_eval_input`; analiza una " +"expresión, evalúa y retorna su valor." #: ../Doc/faq/extending.rst:80 msgid "How do I extract C values from a Python object?" -msgstr "" +msgstr "¿Cómo extraigo valores C de un objeto Python?" #: ../Doc/faq/extending.rst:82 msgid "" @@ -121,6 +157,10 @@ msgid "" "specified index. Lists have similar functions, :c:func:`PyListSize` and :c:" "func:`PyList_GetItem`." msgstr "" +"Eso depende del tipo de objeto. Si es una tupla, :c:func:`PyTuple_Size` " +"retorna su tamaño, y :c:func:`PyTuple_GetItem` retorna el ítem del índice " +"especificado. Las listas tienen funciones similares, :c:func:`PyListSize` " +"and :c:func:`PyList_GetItem`." #: ../Doc/faq/extending.rst:87 msgid "" @@ -129,6 +169,10 @@ msgid "" "Note that Python bytes objects may contain null bytes so C's :c:func:" "`strlen` should not be used." msgstr "" +"Para bytes :c:func:`PyBytes_Size` retorna su tamaño, y :c:func:" +"`PyBytes_AsStringAndSize` proporciona un puntero a su valor y tamaño. Nota " +"que los objetos byte de Python pueden contener bytes *null* por lo que la " +"función de C :c:func:`strlen` no debe ser utilizada." #: ../Doc/faq/extending.rst:92 msgid "" @@ -136,6 +180,9 @@ msgid "" "use :c:func:`PyBytes_Check`, :c:func:`PyTuple_Check`, :c:func:" "`PyList_Check`, etc." msgstr "" +"Para testear el tipo de un objeto, primero debes estar seguro que no es " +"``NULL``, y luego usa :c:func:`PyBytes_Check`, :c:func:`PyTuple_Check`, :c:" +"func:`PyList_Check`, etc." #: ../Doc/faq/extending.rst:95 msgid "" @@ -146,18 +193,25 @@ msgid "" "as many other useful protocols such as numbers (:c:func:`PyNumber_Index` et " "al.) and mappings in the PyMapping APIs." msgstr "" +"También hay una API de alto nivel para objetos Python que son provistos por " +"la supuestamente llamada interfaz 'abstracta' -- lee ``Include/abstract.h`` " +"para mas detalles. Permite realizar una interfaz con cualquier tipo de " +"secuencia Python usando llamadas como :c:func:`PySequence_Length`, :c:func:" +"`PySequence_GetItem`, etc. así como otros protocolos útiles como números (:c:" +"func:`PyNumber_Index` et al.) y mapeos en las *PyMapping APIs*." #: ../Doc/faq/extending.rst:104 msgid "How do I use Py_BuildValue() to create a tuple of arbitrary length?" msgstr "" +"¿Cómo utilizo Py_BuildValue() para crear una tupla de un tamaño arbitrario?" #: ../Doc/faq/extending.rst:106 msgid "You can't. Use :c:func:`PyTuple_Pack` instead." -msgstr "" +msgstr "No puedes hacerlo. Utiliza a cambio :c:func:`PyTuple_Pack`." #: ../Doc/faq/extending.rst:110 msgid "How do I call an object's method from C?" -msgstr "" +msgstr "¿Cómo puedo llamar un método de un objeto desde C?" #: ../Doc/faq/extending.rst:112 msgid "" @@ -166,6 +220,10 @@ msgid "" "to call, a format string like that used with :c:func:`Py_BuildValue`, and " "the argument values::" msgstr "" +"Se puede utilizar la función :c:func:`PyObject_CallMethod` para llamar a un " +"método arbitrario de un objeto. Los parámetros son el objeto, el nombre del " +"método a llamar, una cadena de caracteres de formato como las usadas con :c:" +"func:`Py_BuildValue`, y los valores de argumento ::" #: ../Doc/faq/extending.rst:121 msgid "" @@ -173,12 +231,17 @@ msgid "" "defined. You are responsible for eventually :c:func:`Py_DECREF`\\ 'ing the " "return value." msgstr "" +"Esto funciona para cualquier objeto que tenga métodos -- sean estos " +"incorporados o definidos por el usuario. Eres responsable si eventualmente " +"usas :c:func:`Py_DECREF` en el valor de retorno.\"" #: ../Doc/faq/extending.rst:124 msgid "" "To call, e.g., a file object's \"seek\" method with arguments 10, 0 " "(assuming the file object pointer is \"f\")::" msgstr "" +"Para llamar, por ejemplo, un método \"seek\" de un objeto archivo con " +"argumentos 10, 0 (considerando que puntero del objeto archivo es \"f\")::" #: ../Doc/faq/extending.rst:135 msgid "" @@ -187,12 +250,18 @@ msgid "" "format, and to call a function with one argument, surround the argument in " "parentheses, e.g. \"(i)\"." msgstr "" +"Note que debido a :c:func:`PyObject_CallObject` *siempre* necesita una tupla " +"para la lista de argumento, para llamar una función sin argumentos, deberás " +"pasar \"()\" para el formato, y para llamar a una función con un solo " +"argumento, encierra el argumento entre paréntesis, por ejemplo \"(i)\"." #: ../Doc/faq/extending.rst:142 msgid "" "How do I catch the output from PyErr_Print() (or anything that prints to " "stdout/stderr)?" msgstr "" +"¿Cómo obtengo la salida de PyErr_Print() (o cualquier cosa que se imprime a " +"stdout/stderr)?" #: ../Doc/faq/extending.rst:144 msgid "" @@ -201,22 +270,27 @@ msgid "" "print_error, or just allow the standard traceback mechanism to work. Then, " "the output will go wherever your ``write()`` method sends it." msgstr "" +"En código Python, define un objeto que soporta el método ``write()``. Asigna " +"este objeto a :data:`sys.stdout` y :data:`sys.stderr`. Llama a print_error, " +"o solo permite que el mecanismo estándar de rastreo funcione. Luego, la " +"salida se hará cuando invoques ``write()``." #: ../Doc/faq/extending.rst:149 msgid "The easiest way to do this is to use the :class:`io.StringIO` class:" msgstr "" +"La manera mas fácil de hacer esto es usar la clase :class:`io.StringIO`." #: ../Doc/faq/extending.rst:161 msgid "A custom object to do the same would look like this:" -msgstr "" +msgstr "Un objeto personalizado para hacer lo mismo se vería así:" #: ../Doc/faq/extending.rst:182 msgid "How do I access a module written in Python from C?" -msgstr "" +msgstr "¿Cómo accedo al módulo escrito en Python desde C?" #: ../Doc/faq/extending.rst:184 msgid "You can get a pointer to the module object as follows::" -msgstr "" +msgstr "Puedes obtener un puntero al módulo objeto de esta manera:" #: ../Doc/faq/extending.rst:188 msgid "" @@ -226,22 +300,31 @@ msgid "" "module into any namespace -- it only ensures it has been initialized and is " "stored in :data:`sys.modules`." msgstr "" +"Si el módulo todavía no se importó, (por ejemplo aún no esta presente en :" +"data:`sys.modules`), esto inicializa el módulo, de otra forma simplemente " +"retorna el valor de ``sys.modules[\"\"]``. Nota que no entra el " +"módulo a ningún espacio de nombres (*namespace*) --solo asegura que fue " +"inicializado y guardado en :data:`sys.modules`." #: ../Doc/faq/extending.rst:194 msgid "" "You can then access the module's attributes (i.e. any name defined in the " "module) as follows::" msgstr "" +"Puedes acceder luego a los atributos del módulo (por ejemplo a cualquier " +"nombre definido en el módulo) de esta forma:" #: ../Doc/faq/extending.rst:199 msgid "" "Calling :c:func:`PyObject_SetAttrString` to assign to variables in the " "module also works." msgstr "" +"También funciona llamar a :c:func:`PyObject_SetAttrString` para asignar a " +"variables en el módulo." #: ../Doc/faq/extending.rst:204 msgid "How do I interface to C++ objects from Python?" -msgstr "" +msgstr "¿Cómo hago una interface a objetos C++ desde Python?" #: ../Doc/faq/extending.rst:206 msgid "" @@ -252,14 +335,22 @@ msgid "" "building a new Python type around a C structure (pointer) type will also " "work for C++ objects." msgstr "" +"Dependiendo de lo que necesites, hay varias maneras de hacerlo. Para hacerlo " +"manualmente empieza por leer :ref:`the \"Extending and Embedding\" document " +"`.Fíjate que para el sistema de tiempo de ejecución Python, " +"no hay una gran diferencia entre C y C++, por lo que la estrategia de " +"construir un nuevo tipo Python alrededor de una estructura de C de tipo " +"puntero, también funcionará para objetos C++." #: ../Doc/faq/extending.rst:212 msgid "For C++ libraries, see :ref:`c-wrapper-software`." -msgstr "" +msgstr "Para bibliotecas C++, mira :ref:`c-wrapper-software`." #: ../Doc/faq/extending.rst:216 msgid "I added a module using the Setup file and the make fails; why?" msgstr "" +"He agregado un módulo usando el archivo de configuración y el *make* falla. " +"¿Porque?" #: ../Doc/faq/extending.rst:218 msgid "" @@ -267,30 +358,40 @@ msgid "" "fails. (Fixing this requires some ugly shell script hackery, and this bug " "is so minor that it doesn't seem worth the effort.)" msgstr "" +"La configuración debe terminar en una nueva linea, si esta no está, entonces " +"el proceso *build* falla. (reparar esto requiere algún truco de linea de " +"comandos que puede ser no muy prolijo, y seguramente el error es tan pequeño " +"que no valdrá el esfuerzo.)" #: ../Doc/faq/extending.rst:224 msgid "How do I debug an extension?" -msgstr "" +msgstr "¿Cómo puedo depurar una extención?" #: ../Doc/faq/extending.rst:226 +#, fuzzy msgid "" "When using GDB with dynamically loaded extensions, you can't set a " "breakpoint in your extension until your extension is loaded." msgstr "" +"Cuando se usa GDB con extensiones cargadas de forma dinámica, puedes " +"configurar un punto de verificación (*breakpoint*) en tu extensión hasta que " +"esta se cargue." #: ../Doc/faq/extending.rst:229 msgid "In your ``.gdbinit`` file (or interactively), add the command:" -msgstr "" +msgstr "En tu archivo ``.gdbinit`` (o interactivamente), agrega el comando:" #: ../Doc/faq/extending.rst:235 msgid "Then, when you run GDB:" -msgstr "" +msgstr "Luego, cuando corras GDB:" #: ../Doc/faq/extending.rst:247 msgid "" "I want to compile a Python module on my Linux system, but some files are " "missing. Why?" msgstr "" +"Quiero compilar un módulo Python en mi sistema Linux, pero me faltan algunos " +"archivos . ¿Por qué?" #: ../Doc/faq/extending.rst:249 msgid "" @@ -298,18 +399,24 @@ msgid "" "{x}/config/` directory, which contains various files required for compiling " "Python extensions." msgstr "" +"La mayoría de las versiones empaquetadas de Python no incluyen el " +"directorio :file:`/usr/lib/python2.{x}/config/`, que contiene varios " +"archivos que son necesarios para compilar las extensiones Python." #: ../Doc/faq/extending.rst:253 msgid "For Red Hat, install the python-devel RPM to get the necessary files." msgstr "" +"Para *Red Hat*, instala el *python-devel RPM* para obtener los archivos " +"necesarios." #: ../Doc/faq/extending.rst:255 msgid "For Debian, run ``apt-get install python-dev``." -msgstr "" +msgstr "Para Debian, corre ``apt-get install python-dev``." #: ../Doc/faq/extending.rst:259 +#, fuzzy msgid "How do I tell \"incomplete input\" from \"invalid input\"?" -msgstr "" +msgstr "¿Cómo digo \"incomplete input\" desde \"invalid input\"?" #: ../Doc/faq/extending.rst:261 msgid "" @@ -319,12 +426,21 @@ msgid "" "parentheses or triple string quotes), but it gives you a syntax error " "message immediately when the input is invalid." msgstr "" +"A veces quieres emular el comportamiento del interprete interactivo de " +"Python, que te da una continuación del *prompt* cuando la entrada esta " +"incompleta (por ejemplo si comenzaste tu instrucción \"if\" o no cerraste un " +"paréntesis o triples comillas), pero te da un mensaje de error de sintaxis " +"inmediatamente cuando la entrada es invalida." #: ../Doc/faq/extending.rst:267 +#, fuzzy msgid "" "In Python you can use the :mod:`codeop` module, which approximates the " "parser's behavior sufficiently. IDLE uses this, for example." msgstr "" +"En Python puedes usar el módulo :mod:`codeop`, que aproxima el " +"comportamiento del analizador gramatical (*parser*) . IDLE usa esto, por " +"ejemplo." #: ../Doc/faq/extending.rst:270 msgid "" @@ -334,6 +450,11 @@ msgid "" "to point at your custom input function. See ``Modules/readline.c`` and " "``Parser/myreadline.c`` for more hints." msgstr "" +"La manera mas fácil de hacerlo en C es llamar a :c:func:" +"`PyRun_InteractiveLoop` (quizá en un hilo separado) y dejar que el " +"interprete Python gestione la entrada por ti. Puedes también configurar :c:" +"func:`PyOS_ReadlineFunctionPointer` para apuntar a tu función de entrada " +"personalizada." #: ../Doc/faq/extending.rst:276 msgid "" @@ -344,6 +465,13 @@ msgid "" "error`` equal to ``E_EOF``, which means the input is incomplete. Here's a " "sample code fragment, untested, inspired by code from Alex Farber::" msgstr "" +"De todas maneras a veces debes correr el interprete embebido de Python en el " +"mismo hilo que tu *api rest*, y puedes permitir que :c:func:" +"`PyRun_InteractiveLoop` termine mientras espera por la entrada del usuario. " +"La primera solución es llamar a :c:func:`PyParser_ParseString` y probar con " +"``e.error`` igual a ``E_EOF``, que significa que la entrada esta incompleta. " +"Aquí hay un fragmento de código ejemplo, que no esta probado, inspirado en " +"el código de Alex Farber:" #: ../Doc/faq/extending.rst:310 msgid "" @@ -356,10 +484,20 @@ msgid "" "\". Here is a complete example using the GNU readline library (you may want " "to ignore **SIGINT** while calling readline())::" msgstr "" +"Otra solución es intentar compilar la cadena de caracteres recibida con :c:" +"func:`Py_CompileString`. Si compila sin errores, intenta ejecutar el objeto " +"código retornado llamando a :c:func:`PyEval_EvalCode`. De otra manera salva " +"el ingreso para después. Si la compilación falla, encuentra si hay algún o " +"si necesita algún ingreso adicional - extrayendo la cadena de caracteres " +"mensaje de la tupla excepción y comparándola con la cadena de caracteres " +"\"unexpected EOF while parsing\". Aquí hay un ejemplo completo usando la " +"biblioteca *GNU readline* (Seguramente querrás ignorar **SIGINT** mientras " +"llamas a readline())::" #: ../Doc/faq/extending.rst:432 +#, fuzzy msgid "How do I find undefined g++ symbols __builtin_new or __pure_virtual?" -msgstr "" +msgstr "¿Cómo encuentro símbolos g++ __builtin_new or __pure_virtual?" #: ../Doc/faq/extending.rst:434 msgid "" @@ -367,18 +505,26 @@ msgid "" "it using g++ (change LINKCC in the Python Modules Makefile), and link your " "extension module using g++ (e.g., ``g++ -shared -o mymodule.so mymodule.o``)." msgstr "" +"Para cargar dinámicamente módulos de extensión g++, debes recompilar Python, " +"hacer un nuevo *link* usando g++ (cambia LINKCC en el Python Modules " +"Makefile) y enlaza *link* tu extensión usando g++ (por ejemplo `g++ -shared -" +"o mymodule.so mymodule.o``)." #: ../Doc/faq/extending.rst:440 msgid "" "Can I create an object class with some methods implemented in C and others " "in Python (e.g. through inheritance)?" msgstr "" +"¿Puedo crear una clase objeto con algunos métodos implementado en C y otros " +"en Python (por ejemplo a través de la herencia)?" #: ../Doc/faq/extending.rst:442 msgid "" "Yes, you can inherit from built-in classes such as :class:`int`, :class:" "`list`, :class:`dict`, etc." msgstr "" +"Si, puedes heredar de clases integradas como :class:`int`, :class:`list`, :" +"class:`dict`, etc." #: ../Doc/faq/extending.rst:445 msgid "" @@ -386,3 +532,6 @@ msgid "" "html) provides a way of doing this from C++ (i.e. you can inherit from an " "extension class written in C++ using the BPL)." msgstr "" +"La biblioteca *Boost Pyhton* (BPL, http://www.boost.org/libs/python/doc/" +"index.html) provee una manera de realizar esto desde C++ (por ejemplo puedes " +"heredar de una clase extensión escrita en C++ usando el BPL)."