# Copyright (C) 2001-2020, Python Software Foundation # This file is distributed under the same license as the Python package. # Maintained by the python-doc-es workteam. # docs-es@python.org / # https://mail.python.org/mailman3/lists/docs-es.python.org/ # Check https://github.com/python/python-docs-es/blob/3.8/TRANSLATORS to # get the list of volunteers # msgid "" msgstr "" "Project-Id-Version: Python 3.8\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2022-10-25 19:47+0200\n" "PO-Revision-Date: 2021-08-07 10:59+0200\n" "Last-Translator: Cristián Maureira-Fredes \n" "Language: es\n" "Language-Team: python-doc-es\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" "Generated-By: Babel 2.10.3\n" #: ../Doc/library/argparse.rst:2 msgid "" ":mod:`argparse` --- Parser for command-line options, arguments and sub-" "commands" msgstr "" ":mod:`argparse` — Analizador sintáctico (*Parser*) para las opciones, " "argumentos y sub-comandos de la línea de comandos" #: ../Doc/library/argparse.rst:12 msgid "**Source code:** :source:`Lib/argparse.py`" msgstr "**Código fuente:** :source:`Lib/argparse.py`" msgid "Tutorial" msgstr "Tutorial" #: ../Doc/library/argparse.rst:18 msgid "" "This page contains the API reference information. For a more gentle " "introduction to Python command-line parsing, have a look at the :ref:" "`argparse tutorial `." msgstr "" "Esta página contiene la información de referencia de la API. Para una " "introducción más amigable al análisis de la línea de comandos de Python, " "echa un vistazo al :ref:`argparse tutorial `." #: ../Doc/library/argparse.rst:22 #, fuzzy msgid "" "The :mod:`argparse` module makes it easy to write user-friendly command-line " "interfaces. The program defines what arguments it requires, and :mod:" "`argparse` will figure out how to parse those out of :data:`sys.argv`. The :" "mod:`argparse` module also automatically generates help and usage messages. " "The module will also issue errors when users give the program invalid " "arguments." msgstr "" "El módulo :mod:`argparse` facilita la escritura de interfaces de línea de " "comandos amigables. El programa define qué argumentos requiere, y :mod:" "`argparse` averiguará cómo analizar los de :data:`sys.argv`. El módulo :mod:" "`argparse` también genera automáticamente mensajes de ayuda y de uso y " "muestra errores cuando los usuarios dan parámetros incorrectos al programa." #: ../Doc/library/argparse.rst:30 msgid "Core Functionality" msgstr "" #: ../Doc/library/argparse.rst:32 msgid "" "The :mod:`argparse` module's support for command-line interfaces is built " "around an instance of :class:`argparse.ArgumentParser`. It is a container " "for argument specifications and has options that apply the parser as whole::" msgstr "" #: ../Doc/library/argparse.rst:41 msgid "" "The :meth:`ArgumentParser.add_argument` method attaches individual argument " "specifications to the parser. It supports positional arguments, options " "that accept values, and on/off flags::" msgstr "" #: ../Doc/library/argparse.rst:50 msgid "" "The :meth:`ArgumentParser.parse_args` method runs the parser and places the " "extracted data in a :class:`argparse.Namespace` object::" msgstr "" #: ../Doc/library/argparse.rst:58 msgid "Quick Links for add_argument()" msgstr "" #: ../Doc/library/argparse.rst:61 msgid "Name" msgstr "" #: ../Doc/library/argparse.rst:61 #, fuzzy msgid "Description" msgstr "*description*" #: ../Doc/library/argparse.rst:61 msgid "Values" msgstr "" #: ../Doc/library/argparse.rst:63 #, fuzzy msgid "action_" msgstr "*action*" #: ../Doc/library/argparse.rst:63 msgid "Specify how an argument should be handled" msgstr "" #: ../Doc/library/argparse.rst:63 msgid "" "``'store'``, ``'store_const'``, ``'store_true'``, ``'append'``, " "``'append_const'``, ``'count'``, ``'help'``, ``'version'``" msgstr "" #: ../Doc/library/argparse.rst:64 #, fuzzy msgid "choices_" msgstr "*choices*" #: ../Doc/library/argparse.rst:64 msgid "Limit values to a specific set of choices" msgstr "" #: ../Doc/library/argparse.rst:64 msgid "" "``['foo', 'bar']``, ``range(1, 10)``, or :class:`~collections.abc.Container` " "instance" msgstr "" #: ../Doc/library/argparse.rst:65 #, fuzzy msgid "const_" msgstr "*const*" #: ../Doc/library/argparse.rst:65 msgid "Store a constant value" msgstr "" #: ../Doc/library/argparse.rst:66 #, fuzzy msgid "default_" msgstr "*default*" #: ../Doc/library/argparse.rst:66 msgid "Default value used when an argument is not provided" msgstr "" #: ../Doc/library/argparse.rst:66 msgid "Defaults to *None*" msgstr "" #: ../Doc/library/argparse.rst:67 #, fuzzy msgid "dest_" msgstr "*dest*" #: ../Doc/library/argparse.rst:67 msgid "Specify the attribute name used in the result namespace" msgstr "" #: ../Doc/library/argparse.rst:68 #, fuzzy msgid "help_" msgstr "*help*" #: ../Doc/library/argparse.rst:68 msgid "Help message for an argument" msgstr "" #: ../Doc/library/argparse.rst:69 #, fuzzy msgid "metavar_" msgstr "*metavar*" #: ../Doc/library/argparse.rst:69 msgid "Alternate display name for the argument as shown in help" msgstr "" #: ../Doc/library/argparse.rst:70 #, fuzzy msgid "nargs_" msgstr "*nargs*" #: ../Doc/library/argparse.rst:70 msgid "Number of times the argument can be used" msgstr "" #: ../Doc/library/argparse.rst:70 msgid ":class:`int`, ``'?'``, ``'*'``, ``'+'``, or ``argparse.REMAINDER``" msgstr "" #: ../Doc/library/argparse.rst:71 #, fuzzy msgid "required_" msgstr "*required*" #: ../Doc/library/argparse.rst:71 msgid "Indicate whether an argument is required or optional" msgstr "" #: ../Doc/library/argparse.rst:71 msgid "``True`` or ``False``" msgstr "" #: ../Doc/library/argparse.rst:72 #, fuzzy msgid "type_" msgstr "*type*" #: ../Doc/library/argparse.rst:72 msgid "Automatically convert an argument to the given type" msgstr "" #: ../Doc/library/argparse.rst:72 msgid "" ":class:`int`, :class:`float`, ``argparse.FileType('w')``, or callable " "function" msgstr "" #: ../Doc/library/argparse.rst:77 msgid "Example" msgstr "Ejemplo" #: ../Doc/library/argparse.rst:79 msgid "" "The following code is a Python program that takes a list of integers and " "produces either the sum or the max::" msgstr "" "El siguiente código es un programa Python que toma una lista de números " "enteros y obtiene la suma o el máximo::" #: ../Doc/library/argparse.rst:94 #, fuzzy msgid "" "Assuming the above Python code is saved into a file called ``prog.py``, it " "can be run at the command line and it provides useful help messages:" msgstr "" "Asumiendo que el código Python anterior se guarda en un archivo llamado " "``prog.py``, se puede ejecutar en la línea de comandos y proporciona " "mensajes de ayuda útiles:" #: ../Doc/library/argparse.rst:111 msgid "" "When run with the appropriate arguments, it prints either the sum or the max " "of the command-line integers:" msgstr "" "Cuando se ejecuta con los parámetros apropiados, muestra la suma o el máximo " "de los números enteros de la línea de comandos:" #: ../Doc/library/argparse.rst:122 #, fuzzy msgid "If invalid arguments are passed in, an error will be displayed:" msgstr "Si se pasan argumentos incorrectos, se mostrará un error:" #: ../Doc/library/argparse.rst:130 msgid "The following sections walk you through this example." msgstr "Las siguientes secciones te guiarán a través de este ejemplo." #: ../Doc/library/argparse.rst:134 msgid "Creating a parser" msgstr "Creando un analizador sintáctico (*parser*)" #: ../Doc/library/argparse.rst:136 msgid "" "The first step in using the :mod:`argparse` is creating an :class:" "`ArgumentParser` object::" msgstr "" "El primer paso para usar :mod:`argparse` es crear un objeto :class:" "`ArgumentParser` ::" #: ../Doc/library/argparse.rst:141 msgid "" "The :class:`ArgumentParser` object will hold all the information necessary " "to parse the command line into Python data types." msgstr "" "El objeto :class:`ArgumentParser` contendrá toda la información necesaria " "para analizar la línea de comandos con los tipos de datos de Python." #: ../Doc/library/argparse.rst:146 msgid "Adding arguments" msgstr "Añadiendo argumentos" #: ../Doc/library/argparse.rst:148 msgid "" "Filling an :class:`ArgumentParser` with information about program arguments " "is done by making calls to the :meth:`~ArgumentParser.add_argument` method. " "Generally, these calls tell the :class:`ArgumentParser` how to take the " "strings on the command line and turn them into objects. This information is " "stored and used when :meth:`~ArgumentParser.parse_args` is called. For " "example::" msgstr "" "Completar un :class:`ArgumentParser` con información sobre los argumentos " "del programa se hace realizando llamadas al método :meth:`~ArgumentParser." "add_argument`. Generalmente, estas llamadas le dicen a :class:" "`ArgumentParser` cómo capturar las cadenas de caracteres de la línea de " "comandos y convertirlas en objetos. Esta información se almacena y se usa " "cuando se llama a :meth:`~ArgumentParser.parse_args`. Por ejemplo::" #: ../Doc/library/argparse.rst:160 #, fuzzy msgid "" "Later, calling :meth:`~ArgumentParser.parse_args` will return an object with " "two attributes, ``integers`` and ``accumulate``. The ``integers`` attribute " "will be a list of one or more integers, and the ``accumulate`` attribute " "will be either the :func:`sum` function, if ``--sum`` was specified at the " "command line, or the :func:`max` function if it was not." msgstr "" "Más tarde, llamando a :meth:`~ArgumentParser.parse_args` retornará un objeto " "con dos atributos, ``integers`` y ``accumulate``. El atributo ``integers`` " "será una lista de uno o más enteros, y el atributo ``accumulate`` será la " "función :func:`sum`, si se especificó ``--sum`` en la línea de comandos, o " "la función :func:`max` si no." #: ../Doc/library/argparse.rst:168 msgid "Parsing arguments" msgstr "Analizando argumentos" #: ../Doc/library/argparse.rst:170 msgid "" ":class:`ArgumentParser` parses arguments through the :meth:`~ArgumentParser." "parse_args` method. This will inspect the command line, convert each " "argument to the appropriate type and then invoke the appropriate action. In " "most cases, this means a simple :class:`Namespace` object will be built up " "from attributes parsed out of the command line::" msgstr "" ":class:`ArgumentParser` analiza los argumentos mediante el método :meth:" "`~ArgumentParser.parse_args`. Éste inspeccionará la línea de comandos, " "convertirá cada argumento al tipo apropiado y luego invocará la acción " "correspondiente. En la mayoría de los casos, esto significa que un simple " "objeto :class:`Namespace` se construirá a partir de los atributos analizados " "en la línea de comandos::" #: ../Doc/library/argparse.rst:179 msgid "" "In a script, :meth:`~ArgumentParser.parse_args` will typically be called " "with no arguments, and the :class:`ArgumentParser` will automatically " "determine the command-line arguments from :data:`sys.argv`." msgstr "" "En un *script*, :meth:`~ArgumentParser.parse_args` será llamado típicamente " "sin argumentos, y la :class:`ArgumentParser` determinará automáticamente los " "argumentos de la línea de comandos de :data:`sys.argv`." #: ../Doc/library/argparse.rst:185 msgid "ArgumentParser objects" msgstr "Objetos *ArgumentParser*" #: ../Doc/library/argparse.rst:194 msgid "" "Create a new :class:`ArgumentParser` object. All parameters should be passed " "as keyword arguments. Each parameter has its own more detailed description " "below, but in short they are:" msgstr "" "Crea un nuevo objeto :class:`ArgumentParser`. Todos los parámetros deben " "pasarse como argumentos de palabra clave. Cada parámetro tiene su propia " "descripción más detallada a continuación, pero en resumen son:" #: ../Doc/library/argparse.rst:198 #, fuzzy msgid "" "prog_ - The name of the program (default: ``os.path.basename(sys.argv[0])``)" msgstr "prog_ - El nombre del programa (default: ``sys.argv[0]``)" #: ../Doc/library/argparse.rst:201 msgid "" "usage_ - The string describing the program usage (default: generated from " "arguments added to parser)" msgstr "" "usage_ - La cadena de caracteres que describe el uso del programa (por " "defecto: generado a partir de los argumentos añadidos al analizador)" #: ../Doc/library/argparse.rst:204 msgid "description_ - Text to display before the argument help (default: none)" msgstr "" "description_ - Texto a mostrar antes del argumento ayuda (por defecto: " "ninguno)" #: ../Doc/library/argparse.rst:206 msgid "epilog_ - Text to display after the argument help (default: none)" msgstr "" "epilog_ - Texto a mostrar después del argumento ayuda (por defecto: ninguno)" #: ../Doc/library/argparse.rst:208 msgid "" "parents_ - A list of :class:`ArgumentParser` objects whose arguments should " "also be included" msgstr "" "parents_ - Una lista de objetos :class:`ArgumentParser` cuyos argumentos " "también deberían ser incluidos" #: ../Doc/library/argparse.rst:211 msgid "formatter_class_ - A class for customizing the help output" msgstr "formatter_class_ - Una clase para personalizar la salida de la ayuda" #: ../Doc/library/argparse.rst:213 msgid "" "prefix_chars_ - The set of characters that prefix optional arguments " "(default: '-')" msgstr "" "prefix_chars_ - El conjunto de caracteres que preceden a los argumentos " "opcionales (por defecto: ‘-‘)" #: ../Doc/library/argparse.rst:216 msgid "" "fromfile_prefix_chars_ - The set of characters that prefix files from which " "additional arguments should be read (default: ``None``)" msgstr "" "fromfile_prefix_chars_ - El conjunto de caracteres que preceden a los " "archivos de los cuales se deberían leer los argumentos adicionales (por " "defecto: ``None``)" #: ../Doc/library/argparse.rst:219 msgid "" "argument_default_ - The global default value for arguments (default: " "``None``)" msgstr "" "argument_default_ - El valor global por defecto de los argumentos (por " "defecto: ``None``)" #: ../Doc/library/argparse.rst:222 msgid "" "conflict_handler_ - The strategy for resolving conflicting optionals " "(usually unnecessary)" msgstr "" "conflict_handler_ - La estrategia para resolver los opcionales conflictivos " "(normalmente es innecesaria)" #: ../Doc/library/argparse.rst:225 msgid "" "add_help_ - Add a ``-h/--help`` option to the parser (default: ``True``)" msgstr "" "add_help_ - Añade una opción ``-h/--help`` al analizador (por defecto: " "``True``)" #: ../Doc/library/argparse.rst:227 msgid "" "allow_abbrev_ - Allows long options to be abbreviated if the abbreviation is " "unambiguous. (default: ``True``)" msgstr "" "allow_abbrev_ - Permite abreviar las opciones largas si la abreviatura es " "inequívoca. (por defecto: ``True``)" #: ../Doc/library/argparse.rst:230 msgid "" "exit_on_error_ - Determines whether or not ArgumentParser exits with error " "info when an error occurs. (default: ``True``)" msgstr "" "exit_on_error_ - Determina si ArgumentParser sale o no con información de " "error cuando se produce un error. (predeterminado: ``True``)" #: ../Doc/library/argparse.rst:233 msgid "*allow_abbrev* parameter was added." msgstr "se añadió el parámetro *allow_abbrev*." #: ../Doc/library/argparse.rst:236 msgid "" "In previous versions, *allow_abbrev* also disabled grouping of short flags " "such as ``-vv`` to mean ``-v -v``." msgstr "" "En versiones anteriores, *allow_abbrev* también deshabilitaba la agrupación " "de banderas (*flags*) cortas como ``-vv`` para que sea ``-v -v``." #: ../Doc/library/argparse.rst:240 msgid "*exit_on_error* parameter was added." msgstr "Se agregó el parámetro *exit_on_error*." #: ../Doc/library/argparse.rst:243 ../Doc/library/argparse.rst:769 msgid "The following sections describe how each of these are used." msgstr "" "En las siguientes secciones se describe cómo se utiliza cada una de ellas." #: ../Doc/library/argparse.rst:249 msgid "prog" msgstr "*prog*" #: ../Doc/library/argparse.rst:251 msgid "" "By default, :class:`ArgumentParser` objects use ``sys.argv[0]`` to determine " "how to display the name of the program in help messages. This default is " "almost always desirable because it will make the help messages match how the " "program was invoked on the command line. For example, consider a file named " "``myprogram.py`` with the following code::" msgstr "" "Por defecto, los objetos :class:`ArgumentParser` utilizan ``sys.argv[0]`` " "para determinar cómo mostrar el nombre del programa en los mensajes de " "ayuda. Este valor por defecto es casi siempre deseable porque hará que los " "mensajes de ayuda coincidan con la forma en que el programa fue invocado en " "la línea de comandos. Por ejemplo, considera un archivo llamado ``myprogram." "py`` con el siguiente código::" #: ../Doc/library/argparse.rst:262 msgid "" "The help for this program will display ``myprogram.py`` as the program name " "(regardless of where the program was invoked from):" msgstr "" "La ayuda para este programa mostrará ``myprogram.py`` como el nombre del " "programa (sin importar desde dónde se haya invocado el programa):" #: ../Doc/library/argparse.rst:281 msgid "" "To change this default behavior, another value can be supplied using the " "``prog=`` argument to :class:`ArgumentParser`::" msgstr "" "Para cambiar este comportamiento por defecto, se puede proporcionar otro " "valor usando el argumento``prog=`` para :class:`ArgumentParser`::" #: ../Doc/library/argparse.rst:291 #, python-format msgid "" "Note that the program name, whether determined from ``sys.argv[0]`` or from " "the ``prog=`` argument, is available to help messages using the ``%(prog)s`` " "format specifier." msgstr "" "Ten en cuenta que el nombre del programa, ya sea determinado a partir de " "``sys.argv[0]`` o del argumento ``prog=`` , está disponible para los " "mensajes de ayuda usando el especificador de formato ``%(prog)s``." #: ../Doc/library/argparse.rst:308 msgid "usage" msgstr "uso" #: ../Doc/library/argparse.rst:310 msgid "" "By default, :class:`ArgumentParser` calculates the usage message from the " "arguments it contains::" msgstr "" "Por defecto, :class:`ArgumentParser` determina el mensaje de uso a partir de " "los argumentos que contiene::" #: ../Doc/library/argparse.rst:326 msgid "" "The default message can be overridden with the ``usage=`` keyword argument::" msgstr "" "El mensaje por defecto puede ser sustituido con el argumento de palabra " "clave ``usage=``::" #: ../Doc/library/argparse.rst:341 #, python-format msgid "" "The ``%(prog)s`` format specifier is available to fill in the program name " "in your usage messages." msgstr "" "El especificador de formato ``%(prog)s`` está preparado para introducir el " "nombre del programa en los mensajes de ayuda." #: ../Doc/library/argparse.rst:348 msgid "description" msgstr "*description*" #: ../Doc/library/argparse.rst:350 msgid "" "Most calls to the :class:`ArgumentParser` constructor will use the " "``description=`` keyword argument. This argument gives a brief description " "of what the program does and how it works. In help messages, the " "description is displayed between the command-line usage string and the help " "messages for the various arguments::" msgstr "" "La mayoría de las llamadas al constructor :class:`ArgumentParser` usarán el " "argumento de palabra clave ``description=``. Este argumento da una breve " "descripción de lo que hace el programa y cómo funciona. En los mensajes de " "ayuda, la descripción se muestra entre la cadena de caracteres de uso " "(*usage*) de la línea de comandos y los mensajes de ayuda para los distintos " "argumentos::" #: ../Doc/library/argparse.rst:365 msgid "" "By default, the description will be line-wrapped so that it fits within the " "given space. To change this behavior, see the formatter_class_ argument." msgstr "" "Por defecto, la descripción será ajustada a una línea para que encaje en el " "espacio dado. Para cambiar este comportamiento, revisa el argumento " "formatter_class_." #: ../Doc/library/argparse.rst:370 msgid "epilog" msgstr "*epilog*" #: ../Doc/library/argparse.rst:372 msgid "" "Some programs like to display additional description of the program after " "the description of the arguments. Such text can be specified using the " "``epilog=`` argument to :class:`ArgumentParser`::" msgstr "" "A algunos programas les gusta mostrar una descripción adicional del programa " "después de la descripción de los argumentos. Dicho texto puede ser " "especificado usando el argumento ``epilog=`` para :class:`ArgumentParser`::" #: ../Doc/library/argparse.rst:389 msgid "" "As with the description_ argument, the ``epilog=`` text is by default line-" "wrapped, but this behavior can be adjusted with the formatter_class_ " "argument to :class:`ArgumentParser`." msgstr "" "Al igual que con el argumento description_, el texto ``epilog=`` está por " "defecto ajustado a una línea, pero este comportamiento puede ser modificado " "con el argumento formatter_class_ para :class:`ArgumentParser`." #: ../Doc/library/argparse.rst:395 msgid "parents" msgstr "*parents*" #: ../Doc/library/argparse.rst:397 msgid "" "Sometimes, several parsers share a common set of arguments. Rather than " "repeating the definitions of these arguments, a single parser with all the " "shared arguments and passed to ``parents=`` argument to :class:" "`ArgumentParser` can be used. The ``parents=`` argument takes a list of :" "class:`ArgumentParser` objects, collects all the positional and optional " "actions from them, and adds these actions to the :class:`ArgumentParser` " "object being constructed::" msgstr "" "A veces, varios analizadores comparten un conjunto de argumentos comunes. En " "lugar de repetir las definiciones de estos argumentos, se puede usar un " "único analizador con todos los argumentos compartidos y pasarlo en el " "argumento ``parents=`` a :class:`ArgumentParser`. El argumento ``parents=`` " "toma una lista de objetos :class:`ArgumentParser`, recoge todas las acciones " "de posición y de opción de éstos, y añade estas acciones al objeto :class:" "`ArgumentParser` que se está construyendo::" #: ../Doc/library/argparse.rst:417 msgid "" "Note that most parent parsers will specify ``add_help=False``. Otherwise, " "the :class:`ArgumentParser` will see two ``-h/--help`` options (one in the " "parent and one in the child) and raise an error." msgstr "" "Ten en cuenta que la mayoría de los analizadores padre especificarán " "``add_help=False``. De lo contrario, el :class:`ArgumentParser` verá dos " "opciones ``-h/—help`` (una para el padre y otra para el hijo) y generará un " "error." #: ../Doc/library/argparse.rst:422 msgid "" "You must fully initialize the parsers before passing them via ``parents=``. " "If you change the parent parsers after the child parser, those changes will " "not be reflected in the child." msgstr "" "Debes inicializar completamente los analizadores antes de pasarlos a través " "de ``parents=``. Si cambias los analizadores padre después del analizador " "hijo, esos cambios no se reflejarán en el hijo." #: ../Doc/library/argparse.rst:430 msgid "formatter_class" msgstr "*formatter_class*" #: ../Doc/library/argparse.rst:432 msgid "" ":class:`ArgumentParser` objects allow the help formatting to be customized " "by specifying an alternate formatting class. Currently, there are four such " "classes:" msgstr "" "los objetos :class:`ArgumentParser` permiten personalizar el formato de la " "ayuda especificando una clase de formato alternativa. Actualmente, hay " "cuatro clases de este tipo:" #: ../Doc/library/argparse.rst:441 msgid "" ":class:`RawDescriptionHelpFormatter` and :class:`RawTextHelpFormatter` give " "more control over how textual descriptions are displayed. By default, :class:" "`ArgumentParser` objects line-wrap the description_ and epilog_ texts in " "command-line help messages::" msgstr "" ":class:`RawDescriptionHelpFormatter` y :class:`RawTextHelpFormatter` dan más " "control sobre cómo se muestran las descripciones de texto. Por defecto, los " "objetos :class:`ArgumentParser` ajustan a la línea los textos de " "description_ y epilog_ en los mensajes de ayuda de la línea de comandos::" #: ../Doc/library/argparse.rst:466 msgid "" "Passing :class:`RawDescriptionHelpFormatter` as ``formatter_class=`` " "indicates that description_ and epilog_ are already correctly formatted and " "should not be line-wrapped::" msgstr "" "Pasar :class:`RawDescriptionHelpFormatter` como ``formatter_class=`` indica " "que description_ y epilog_ ya tienen el formato correcto y no deben ser " "ajustados a la línea::" #: ../Doc/library/argparse.rst:492 msgid "" ":class:`RawTextHelpFormatter` maintains whitespace for all sorts of help " "text, including argument descriptions. However, multiple new lines are " "replaced with one. If you wish to preserve multiple blank lines, add spaces " "between the newlines." msgstr "" ":class:`RawTextHelpFormatter` mantiene espacios en blanco para todo tipo de " "texto de ayuda, incluyendo descripciones de argumentos. Sin embargo, varias " "líneas nuevas son reemplazadas por una sola. Si deseas conservar varias " "líneas en blanco, añade espacios entre las nuevas líneas." #: ../Doc/library/argparse.rst:497 msgid "" ":class:`ArgumentDefaultsHelpFormatter` automatically adds information about " "default values to each of the argument help messages::" msgstr "" ":class:`ArgumentDefaultsHelpFormatter` añade automáticamente información " "sobre los valores por defecto a cada uno de los mensajes de ayuda de los " "argumentos::" #: ../Doc/library/argparse.rst:515 msgid "" ":class:`MetavarTypeHelpFormatter` uses the name of the type_ argument for " "each argument as the display name for its values (rather than using the " "dest_ as the regular formatter does)::" msgstr "" ":class:`MetavarTypeHelpFormatter` utiliza el nombre del parámetro type_ para " "cada argumento como el nombre a mostrar para sus valores (en lugar de " "utilizar dest_ como lo hace el formato habitual)::" #: ../Doc/library/argparse.rst:536 msgid "prefix_chars" msgstr "*prefix_chars*" #: ../Doc/library/argparse.rst:538 msgid "" "Most command-line options will use ``-`` as the prefix, e.g. ``-f/--foo``. " "Parsers that need to support different or additional prefix characters, e.g. " "for options like ``+f`` or ``/foo``, may specify them using the " "``prefix_chars=`` argument to the ArgumentParser constructor::" msgstr "" "La mayoría de las opciones de la línea de comandos usarán ``-`` como " "prefijo, por ejemplo ``-f/--foo``. Los analizadores que necesiten soportar " "caracteres prefijo diferentes o adicionales, por ejemplo, para opciones como " "``+f`` o ``/foo``, pueden especificarlos usando el argumento " "``prefix_chars=`` para el constructor *ArgumentParser*::" #: ../Doc/library/argparse.rst:550 msgid "" "The ``prefix_chars=`` argument defaults to ``'-'``. Supplying a set of " "characters that does not include ``-`` will cause ``-f/--foo`` options to be " "disallowed." msgstr "" "El argumento ``prefix_chars=`` tiene un valor por defecto de ``'-'``. " "Proporcionar un conjunto de caracteres que no incluya ``-`` causará que las " "opciones ``-f/--foo`` no sean inhabilitadas." #: ../Doc/library/argparse.rst:556 msgid "fromfile_prefix_chars" msgstr "*fromfile_prefix_chars*" #: ../Doc/library/argparse.rst:558 #, fuzzy msgid "" "Sometimes, when dealing with a particularly long argument list, it may make " "sense to keep the list of arguments in a file rather than typing it out at " "the command line. If the ``fromfile_prefix_chars=`` argument is given to " "the :class:`ArgumentParser` constructor, then arguments that start with any " "of the specified characters will be treated as files, and will be replaced " "by the arguments they contain. For example::" msgstr "" "A veces, por ejemplo, cuando se trata de una lista de argumentos " "particularmente larga, puede tener sentido mantener la lista de argumentos " "en un archivo en lugar de escribirla en la línea de comandos. Si el " "argumento ``fromfile_prefix_chars=`` se da al constructor :class:" "`ArgumentParser`, entonces los argumentos que empiezan con cualquiera de los " "caracteres especificados se tratarán como archivos, y serán reemplazados por " "los argumentos que contienen. Por ejemplo::" #: ../Doc/library/argparse.rst:572 msgid "" "Arguments read from a file must by default be one per line (but see also :" "meth:`~ArgumentParser.convert_arg_line_to_args`) and are treated as if they " "were in the same place as the original file referencing argument on the " "command line. So in the example above, the expression ``['-f', 'foo', " "'@args.txt']`` is considered equivalent to the expression ``['-f', 'foo', '-" "f', 'bar']``." msgstr "" "Los argumentos leídos de un archivo deben ser por defecto uno por línea " "(pero vea también :meth:`~ArgumentParser.convert_arg_line_to_args`) y se " "tratan como si estuvieran en el mismo lugar que el argumento de referencia " "del archivo original en la línea de comandos. Así, en el ejemplo anterior, " "la expresión ``[‘-f’, ‘foo’, ‘@args.txt’]`` se considera equivalente a la " "expresión ``[‘-f’, ‘foo’, ‘-f’, ‘bar’]``." #: ../Doc/library/argparse.rst:578 msgid "" "The ``fromfile_prefix_chars=`` argument defaults to ``None``, meaning that " "arguments will never be treated as file references." msgstr "" "El argumento ``fromfile_prefix_chars=`` por defecto es ``None``, lo que " "significa que los argumentos nunca serán tratados como referencias de " "archivos." #: ../Doc/library/argparse.rst:583 msgid "argument_default" msgstr "*argument_default*" #: ../Doc/library/argparse.rst:585 msgid "" "Generally, argument defaults are specified either by passing a default to :" "meth:`~ArgumentParser.add_argument` or by calling the :meth:`~ArgumentParser." "set_defaults` methods with a specific set of name-value pairs. Sometimes " "however, it may be useful to specify a single parser-wide default for " "arguments. This can be accomplished by passing the ``argument_default=`` " "keyword argument to :class:`ArgumentParser`. For example, to globally " "suppress attribute creation on :meth:`~ArgumentParser.parse_args` calls, we " "supply ``argument_default=SUPPRESS``::" msgstr "" "Generalmente, los valores por defecto de los argumentos se especifican ya " "sea pasando un valor por defecto a :meth:`~ArgumentParser.add_argument` o " "llamando a los métodos :meth:`~ArgumentParser.set_defaults` con un conjunto " "específico de pares nombre-valor. A veces, sin embargo, puede ser útil " "especificar un único valor por defecto para todos los argumentos del " "analizador. Esto se puede lograr pasando el argumento de palabra clave " "``argument_default=`` a :class:`ArgumentParser`. Por ejemplo, para suprimir " "globalmente la creación de atributos en las llamadas a :meth:" "`~ArgumentParser.parse_args` , proporcionamos el argumento " "``argument_default=SUPPRESS``::" #: ../Doc/library/argparse.rst:605 msgid "allow_abbrev" msgstr "*allow_abbrev*" #: ../Doc/library/argparse.rst:607 msgid "" "Normally, when you pass an argument list to the :meth:`~ArgumentParser." "parse_args` method of an :class:`ArgumentParser`, it :ref:`recognizes " "abbreviations ` of long options." msgstr "" "Normalmente, cuando pasas una lista de argumentos al método :meth:" "`~ArgumentParser.parse_args` de un :class:`ArgumentParser`, :ref:`reconoce " "las abreviaturas ` de las opciones largas." #: ../Doc/library/argparse.rst:611 msgid "This feature can be disabled by setting ``allow_abbrev`` to ``False``::" msgstr "" "Esta característica puede ser desactivada poniendo ``allow_abbrev`` a " "``False``::" #: ../Doc/library/argparse.rst:624 msgid "conflict_handler" msgstr "*conflict_handler*" #: ../Doc/library/argparse.rst:626 msgid "" ":class:`ArgumentParser` objects do not allow two actions with the same " "option string. By default, :class:`ArgumentParser` objects raise an " "exception if an attempt is made to create an argument with an option string " "that is already in use::" msgstr "" "Los objetos :class:`ArgumentParser` no permiten dos acciones con la misma " "cadena de caracteres de opción. Por defecto, los objetos :class:" "`ArgumentParser` lanzan una excepción si se intenta crear un argumento con " "una cadena de caracteres de opción que ya está en uso::" #: ../Doc/library/argparse.rst:638 msgid "" "Sometimes (e.g. when using parents_) it may be useful to simply override any " "older arguments with the same option string. To get this behavior, the " "value ``'resolve'`` can be supplied to the ``conflict_handler=`` argument " "of :class:`ArgumentParser`::" msgstr "" "A veces (por ejemplo, cuando se utiliza parents_) puede ser útil anular " "simplemente cualquier argumento antiguo con la misma cadena de caracteres de " "opción. Para lograr este comportamiento, se puede suministrar el valor " "``'resolve'`` al argumento ``conflict_handler=`` de :class:`ArgumentParser`::" #: ../Doc/library/argparse.rst:654 msgid "" "Note that :class:`ArgumentParser` objects only remove an action if all of " "its option strings are overridden. So, in the example above, the old ``-f/--" "foo`` action is retained as the ``-f`` action, because only the ``--foo`` " "option string was overridden." msgstr "" "Ten en cuenta que los objetos :class:`ArgumentParser` sólo eliminan una " "acción si todas sus cadenas de caracteres de opción están anuladas. Así, en " "el ejemplo anterior, la antigua acción ``-f/--foo`` se mantiene como la " "acción``-f``, porque sólo la cadena de caracteres de opción ``--foo`` fue " "anulada." #: ../Doc/library/argparse.rst:661 msgid "add_help" msgstr "*add_help*" #: ../Doc/library/argparse.rst:663 msgid "" "By default, ArgumentParser objects add an option which simply displays the " "parser's help message. For example, consider a file named ``myprogram.py`` " "containing the following code::" msgstr "" "Por defecto, los objetos *ArgumentParser* añaden una opción que simplemente " "muestra el mensaje de ayuda del analizador. Por ejemplo, considera un " "archivo llamado ``myprogram.py`` que contiene el siguiente código::" #: ../Doc/library/argparse.rst:672 msgid "" "If ``-h`` or ``--help`` is supplied at the command line, the ArgumentParser " "help will be printed:" msgstr "" "Si ``-h`` o ``--help`` se indica en la línea de comandos, se imprimirá la " "ayuda de *ArgumentParser*:" #: ../Doc/library/argparse.rst:684 msgid "" "Occasionally, it may be useful to disable the addition of this help option. " "This can be achieved by passing ``False`` as the ``add_help=`` argument to :" "class:`ArgumentParser`::" msgstr "" "Ocasionalmente, puede ser útil desactivar la inclusión de esta opción de " "ayuda. Esto se puede lograr pasando ``False`` como argumento de " "``add_help=`` a :class:`ArgumentParser`::" #: ../Doc/library/argparse.rst:696 msgid "" "The help option is typically ``-h/--help``. The exception to this is if the " "``prefix_chars=`` is specified and does not include ``-``, in which case ``-" "h`` and ``--help`` are not valid options. In this case, the first character " "in ``prefix_chars`` is used to prefix the help options::" msgstr "" "La opción de ayuda es típicamente ``-h/--help``. La excepción a esto es si " "``prefix_chars=`` se especifica y no incluye ``-``, en cuyo caso ``-h`` y " "``--help`` no son opciones válidas. En este caso, el primer carácter en " "``prefix_chars`` se utiliza para preceder a las opciones de ayuda::" #: ../Doc/library/argparse.rst:711 msgid "exit_on_error" msgstr "exit_on_error" #: ../Doc/library/argparse.rst:713 msgid "" "Normally, when you pass an invalid argument list to the :meth:" "`~ArgumentParser.parse_args` method of an :class:`ArgumentParser`, it will " "exit with error info." msgstr "" "Normalmente, cuando pasa una lista de argumentos no válidos al método :meth:" "`~ArgumentParser.parse_args` de un :class:`ArgumentParser`, saldrá con " "información de error." #: ../Doc/library/argparse.rst:716 msgid "" "If the user would like to catch errors manually, the feature can be enabled " "by setting ``exit_on_error`` to ``False``::" msgstr "" "Si el usuario desea detectar errores manualmente, la función se puede " "habilitar configurando ``exit_on_error`` en ``False`` ::" #: ../Doc/library/argparse.rst:733 msgid "The add_argument() method" msgstr "El método *add_argument()*" #: ../Doc/library/argparse.rst:739 msgid "" "Define how a single command-line argument should be parsed. Each parameter " "has its own more detailed description below, but in short they are:" msgstr "" "Define cómo se debe interpretar un determinado argumento de línea de " "comandos. Cada parámetro tiene su propia descripción más detallada a " "continuación, pero en resumen son::" #: ../Doc/library/argparse.rst:742 msgid "" "`name or flags`_ - Either a name or a list of option strings, e.g. ``foo`` " "or ``-f, --foo``." msgstr "" "`name or flags`_ - Ya sea un nombre o una lista de cadena de caracteres de " "opción, e.g. ``foo`` o ``-f, --foo``." #: ../Doc/library/argparse.rst:745 msgid "" "action_ - The basic type of action to be taken when this argument is " "encountered at the command line." msgstr "" "action_ - El tipo básico de acción a tomar cuando este argumento se " "encuentra en la línea de comandos." #: ../Doc/library/argparse.rst:748 msgid "nargs_ - The number of command-line arguments that should be consumed." msgstr "" "nargs_ - El número de argumentos de la línea de comandos que deben ser " "consumidos." #: ../Doc/library/argparse.rst:750 msgid "" "const_ - A constant value required by some action_ and nargs_ selections." msgstr "" "const_ - Un valor fijo requerido por algunas selecciones de action_ y nargs_." #: ../Doc/library/argparse.rst:752 msgid "" "default_ - The value produced if the argument is absent from the command " "line and if it is absent from the namespace object." msgstr "" "default_ - El valor producido si el argumento está ausente en la línea de " "comando y si está ausente en el objeto de espacio de nombres." #: ../Doc/library/argparse.rst:755 msgid "" "type_ - The type to which the command-line argument should be converted." msgstr "" "type_ - El tipo al que debe convertirse el argumento de la línea de comandos." #: ../Doc/library/argparse.rst:757 msgid "choices_ - A container of the allowable values for the argument." msgstr "choices_ - Un contenedor con los valores permitidos para el argumento." #: ../Doc/library/argparse.rst:759 msgid "" "required_ - Whether or not the command-line option may be omitted (optionals " "only)." msgstr "" "required_ - Si se puede omitir o no la opción de la línea de comandos (sólo " "opcionales)." #: ../Doc/library/argparse.rst:762 msgid "help_ - A brief description of what the argument does." msgstr "help_ - Una breve descripción de lo que hace el argumento." #: ../Doc/library/argparse.rst:764 msgid "metavar_ - A name for the argument in usage messages." msgstr "metavar_ - Un nombre para el argumento en los mensajes de uso." #: ../Doc/library/argparse.rst:766 msgid "" "dest_ - The name of the attribute to be added to the object returned by :" "meth:`parse_args`." msgstr "" "dest_ - El nombre del atributo que será añadido al objeto retornado por :" "meth:`parse_args`." #: ../Doc/library/argparse.rst:775 msgid "name or flags" msgstr "*name or flags*" #: ../Doc/library/argparse.rst:777 #, fuzzy msgid "" "The :meth:`~ArgumentParser.add_argument` method must know whether an " "optional argument, like ``-f`` or ``--foo``, or a positional argument, like " "a list of filenames, is expected. The first arguments passed to :meth:" "`~ArgumentParser.add_argument` must therefore be either a series of flags, " "or a simple argument name." msgstr "" "El método :meth:`~ArgumentParser.add_argument` debe saber si se espera un " "argumento opcional, como ``-f`` o ``--foo``, o un argumento posicional, como " "una lista de nombres de archivos. Por lo tanto, los primeros argumentos que " "se pasan a :meth:`~ArgumentParser.add_argument` deben ser una serie de " "indicadores (*flags*), o un simple nombre de argumento (*name*). Por " "ejemplo, se puede crear un argumento opcional como::" #: ../Doc/library/argparse.rst:783 #, fuzzy msgid "For example, an optional argument could be created like::" msgstr "mientras que un argumento posicional podría ser creado como::" #: ../Doc/library/argparse.rst:787 msgid "while a positional argument could be created like::" msgstr "mientras que un argumento posicional podría ser creado como::" #: ../Doc/library/argparse.rst:791 msgid "" "When :meth:`~ArgumentParser.parse_args` is called, optional arguments will " "be identified by the ``-`` prefix, and the remaining arguments will be " "assumed to be positional::" msgstr "" "Cuando se llama a :meth:`~ArgumentParser.parse_args` , los argumentos " "opcionales serán identificados por el prefijo ``-``, y el resto de los " "argumentos serán asumidos como posicionales::" #: ../Doc/library/argparse.rst:810 msgid "action" msgstr "*action*" #: ../Doc/library/argparse.rst:812 msgid "" ":class:`ArgumentParser` objects associate command-line arguments with " "actions. These actions can do just about anything with the command-line " "arguments associated with them, though most actions simply add an attribute " "to the object returned by :meth:`~ArgumentParser.parse_args`. The " "``action`` keyword argument specifies how the command-line arguments should " "be handled. The supplied actions are:" msgstr "" "Los objetos :class:`ArgumentParser` asocian los argumentos de la línea de " "comandos con las acciones. Esta acciones pueden hacer casi cualquier cosa " "con los argumentos de línea de comandos asociados a ellas, aunque la mayoría " "de las acciones simplemente añaden un atributo al objeto retornado por :meth:" "`~ArgumentParser.parse_args`. El argumento de palabra clave ``action`` " "especifica cómo deben ser manejados los argumentos de la línea de comandos. " "Las acciones proporcionadas son:" #: ../Doc/library/argparse.rst:818 msgid "" "``'store'`` - This just stores the argument's value. This is the default " "action. For example::" msgstr "" "``'store'`` - Esta sólo almacena el valor del argumento. Esta es la acción " "por defecto. Por ejemplo::" #: ../Doc/library/argparse.rst:826 #, fuzzy msgid "" "``'store_const'`` - This stores the value specified by the const_ keyword " "argument; note that the const_ keyword argument defaults to ``None``. The " "``'store_const'`` action is most commonly used with optional arguments that " "specify some sort of flag. For example::" msgstr "" "``'store_const'`` - Esta almacena el valor especificado por el argumento de " "palabra clave const_ . La acción ``'store_const'`` se usa más comúnmente con " "argumentos opcionales que especifican algún tipo de indicador (*flag*). Por " "ejemplo::" #: ../Doc/library/argparse.rst:836 msgid "" "``'store_true'`` and ``'store_false'`` - These are special cases of " "``'store_const'`` used for storing the values ``True`` and ``False`` " "respectively. In addition, they create default values of ``False`` and " "``True`` respectively. For example::" msgstr "" "``'store_true'`` y ``'store_false'`` - Son casos especiales de " "``'store_const'`` usados para almacenar los valores ``True`` y ``False`` " "respectivamente. Además, crean valores por defecto de ``False`` y ``True`` " "respectivamente. Por ejemplo::" #: ../Doc/library/argparse.rst:848 #, fuzzy msgid "" "``'append'`` - This stores a list, and appends each argument value to the " "list. It is useful to allow an option to be specified multiple times. If the " "default value is non-empty, the default elements will be present in the " "parsed value for the option, with any values from the command line appended " "after those default values. Example usage::" msgstr "" "``'append'`` - Esta almacena una lista, y añade cada valor del argumento a " "la lista. Esto es útil para permitir que una opción sea especificada varias " "veces. Ejemplo de uso::" #: ../Doc/library/argparse.rst:859 msgid "" "``'append_const'`` - This stores a list, and appends the value specified by " "the const_ keyword argument to the list; note that the const_ keyword " "argument defaults to ``None``. The ``'append_const'`` action is typically " "useful when multiple arguments need to store constants to the same list. For " "example::" msgstr "" #: ../Doc/library/argparse.rst:871 msgid "" "``'count'`` - This counts the number of times a keyword argument occurs. For " "example, this is useful for increasing verbosity levels::" msgstr "" "``'count'`` - Esta cuenta el número de veces que un argumento de palabra " "clave aparece. Por ejemplo, esto es útil para incrementar los niveles de " "detalle::" #: ../Doc/library/argparse.rst:879 msgid "Note, the *default* will be ``None`` unless explicitly set to *0*." msgstr "" "Observa, *default* (el valor por defecto) será ``None`` a menos que " "explícitamente se establezca como *0*." #: ../Doc/library/argparse.rst:881 msgid "" "``'help'`` - This prints a complete help message for all the options in the " "current parser and then exits. By default a help action is automatically " "added to the parser. See :class:`ArgumentParser` for details of how the " "output is created." msgstr "" "``'help'`` - Esta imprime un mensaje de ayuda completo para todas las " "opciones del analizador actual y luego termina. Por defecto, se añade una " "acción de ayuda automáticamente al analizador. Ver :class:`ArgumentParser` " "para detalles de cómo se genera la salida." #: ../Doc/library/argparse.rst:886 msgid "" "``'version'`` - This expects a ``version=`` keyword argument in the :meth:" "`~ArgumentParser.add_argument` call, and prints version information and " "exits when invoked::" msgstr "" "``’version’`` - Esta espera un argumento de palabra clave ``version=`` en la " "llamada :meth:`~ArgumentParser.add_argument`, e imprime la información de la " "versión y finaliza cuando es invocada::" #: ../Doc/library/argparse.rst:896 msgid "" "``'extend'`` - This stores a list, and extends each argument value to the " "list. Example usage::" msgstr "" "``’extend’`` - Esta almacena una lista, y extiende cada valor del argumento " "a la lista. Ejemplo de uso::" #: ../Doc/library/argparse.rst:907 msgid "" "You may also specify an arbitrary action by passing an Action subclass or " "other object that implements the same interface. The " "``BooleanOptionalAction`` is available in ``argparse`` and adds support for " "boolean actions such as ``--foo`` and ``--no-foo``::" msgstr "" "También puede especificar una acción arbitraria pasando una subclase de " "Acción u otro objeto que implemente la misma interfaz. " "``BooleanOptionalAction`` está disponible en ``argparse`` y agrega soporte " "para acciones booleanas como ``--foo`` y ``--no-foo``:" #: ../Doc/library/argparse.rst:920 msgid "" "The recommended way to create a custom action is to extend :class:`Action`, " "overriding the ``__call__`` method and optionally the ``__init__`` and " "``format_usage`` methods." msgstr "" "La forma recomendada de crear una acción personalizada es extender :class:" "`Action`, anulando el método ``__call__`` y, opcionalmente, los métodos " "``__init__`` y ``format_usage``." #: ../Doc/library/argparse.rst:924 msgid "An example of a custom action::" msgstr "Un ejemplo de una acción personalizada::" #: ../Doc/library/argparse.rst:944 msgid "For more details, see :class:`Action`." msgstr "Para más detalles, ver :class:`Action`." #: ../Doc/library/argparse.rst:950 msgid "nargs" msgstr "*nargs*" #: ../Doc/library/argparse.rst:952 msgid "" "ArgumentParser objects usually associate a single command-line argument with " "a single action to be taken. The ``nargs`` keyword argument associates a " "different number of command-line arguments with a single action. The " "supported values are:" msgstr "" "Los objetos *ArgumentParser* suelen asociar un único argumento de línea de " "comandos con una única acción a realizar. El argumento de palabra clave " "``nargs`` asocia un número diferente de argumentos de línea de comandos con " "una sola acción. Los valores admitidos son:" #: ../Doc/library/argparse.rst:957 msgid "" "``N`` (an integer). ``N`` arguments from the command line will be gathered " "together into a list. For example::" msgstr "" "``N`` (un entero). ``N`` argumentos de la línea de comandos se agruparán en " "una lista. Por ejemplo::" #: ../Doc/library/argparse.rst:966 msgid "" "Note that ``nargs=1`` produces a list of one item. This is different from " "the default, in which the item is produced by itself." msgstr "" "Ten en cuenta que ``nargs=1`` produce una lista de un elemento. Esto es " "diferente del valor por defecto, en el que el elemento se produce por sí " "mismo." #: ../Doc/library/argparse.rst:971 msgid "" "``'?'``. One argument will be consumed from the command line if possible, " "and produced as a single item. If no command-line argument is present, the " "value from default_ will be produced. Note that for optional arguments, " "there is an additional case - the option string is present but not followed " "by a command-line argument. In this case the value from const_ will be " "produced. Some examples to illustrate this::" msgstr "" "``’?’``. Un argumento se consumirá desde la línea de comandos si es posible, " "y se generará como un sólo elemento. Si no hay ningún argumento de línea de " "comandos, se obtendrá el valor de default_. Ten en cuenta que para los " "argumentos opcionales, hay un caso adicional - la cadena de caracteres de " "opción está presente pero no va seguida de un argumento de línea de " "comandos. En este caso se obtendrá el valor de const_. Algunos ejemplos para " "ilustrar esto::" #: ../Doc/library/argparse.rst:988 msgid "" "One of the more common uses of ``nargs='?'`` is to allow optional input and " "output files::" msgstr "" "Uno de los usos más comunes de ``nargs='?'`` es permitir archivos de entrada " "y salida opcionales::" #: ../Doc/library/argparse.rst:1005 msgid "" "``'*'``. All command-line arguments present are gathered into a list. Note " "that it generally doesn't make much sense to have more than one positional " "argument with ``nargs='*'``, but multiple optional arguments with " "``nargs='*'`` is possible. For example::" msgstr "" "``’*’``. Todos los argumentos presentes en la línea de comandos se recogen " "en una lista. Ten en cuenta que generalmente no tiene mucho sentido tener " "más de un argumento posicional con ``nargs=‘*’``, pero es posible tener " "múltiples argumentos opcionales con ``nargs=‘*’``. Por ejemplo::" #: ../Doc/library/argparse.rst:1019 msgid "" "``'+'``. Just like ``'*'``, all command-line args present are gathered into " "a list. Additionally, an error message will be generated if there wasn't at " "least one command-line argument present. For example::" msgstr "" "``'+'``. Al igual que ``'*'``, todos los argumentos de la línea de comandos " "se recogen en una lista. Además, se generará un mensaje de error si no había " "al menos un argumento presente en la línea de comandos. Por ejemplo::" #: ../Doc/library/argparse.rst:1031 msgid "" "If the ``nargs`` keyword argument is not provided, the number of arguments " "consumed is determined by the action_. Generally this means a single " "command-line argument will be consumed and a single item (not a list) will " "be produced." msgstr "" "Si no se proporciona el argumento de palabra clave ``nargs``, el número de " "argumentos consumidos se determina por action_. Generalmente esto significa " "que se consumirá un único argumento de línea de comandos y se obtendrá un " "único elemento (no una lista)." #: ../Doc/library/argparse.rst:1039 msgid "const" msgstr "*const*" #: ../Doc/library/argparse.rst:1041 msgid "" "The ``const`` argument of :meth:`~ArgumentParser.add_argument` is used to " "hold constant values that are not read from the command line but are " "required for the various :class:`ArgumentParser` actions. The two most " "common uses of it are:" msgstr "" "El argumento ``const`` de :meth:`~ArgumentParser.add_argument` se usa para " "mantener valores constantes que no se leen desde la línea de comandos pero " "que son necesarios para las diversas acciones de :class:`ArgumentParser`. " "Los dos usos más comunes son:" #: ../Doc/library/argparse.rst:1045 #, fuzzy msgid "" "When :meth:`~ArgumentParser.add_argument` is called with " "``action='store_const'`` or ``action='append_const'``. These actions add " "the ``const`` value to one of the attributes of the object returned by :meth:" "`~ArgumentParser.parse_args`. See the action_ description for examples. If " "``const`` is not provided to :meth:`~ArgumentParser.add_argument`, it will " "receive a default value of ``None``." msgstr "" "Cuando :meth:`~ArgumentParser.add_argument` se llama con " "``action='store_const'`` o ``action='append_const'``. Estas acciones añaden " "el valor ``const`` a uno de los atributos del objeto retornado por :meth:" "`~ArgumentParser.parse_args`. Mira la descripción action_ para ver ejemplos." #: ../Doc/library/argparse.rst:1053 #, fuzzy msgid "" "When :meth:`~ArgumentParser.add_argument` is called with option strings " "(like ``-f`` or ``--foo``) and ``nargs='?'``. This creates an optional " "argument that can be followed by zero or one command-line arguments. When " "parsing the command line, if the option string is encountered with no " "command-line argument following it, the value of ``const`` will be assumed " "to be ``None`` instead. See the nargs_ description for examples." msgstr "" "Cuando :meth:`~ArgumentParser.add_argument` se llama con cadenas de " "caracteres de opción (como ``-f`` o ``—foo``) y ``nargs=‘?’``. Esto crea un " "argumento opcional que puede ir seguido de cero o un argumento de línea de " "comandos. Al analizar la línea de comandos, si la cadena de opciones se " "encuentra sin ningún argumento de línea de comandos que la siga, asumirá en " "su lugar el valor de ``const``. Mira la descripción nargs_ para ejemplos." #: ../Doc/library/argparse.rst:1060 msgid "" "``const=None`` by default, including when ``action='append_const'`` or " "``action='store_const'``." msgstr "" #: ../Doc/library/argparse.rst:1067 msgid "default" msgstr "*default*" #: ../Doc/library/argparse.rst:1069 msgid "" "All optional arguments and some positional arguments may be omitted at the " "command line. The ``default`` keyword argument of :meth:`~ArgumentParser." "add_argument`, whose value defaults to ``None``, specifies what value should " "be used if the command-line argument is not present. For optional arguments, " "the ``default`` value is used when the option string was not present at the " "command line::" msgstr "" "Todos los argumentos opcionales y algunos argumentos posicionales pueden ser " "omitidos en la línea de comandos. El argumento de palabra clave ``default`` " "de :meth:`~ArgumentParser.add_argument`, cuyo valor por defecto es ``None``, " "especifica qué valor debe usarse si el argumento de línea de comandos no " "está presente. Para los argumentos opcionales, se usa el valor ``default`` " "cuando la cadena de caracteres de opción no está presente en la línea de " "comandos::" #: ../Doc/library/argparse.rst:1083 msgid "" "If the target namespace already has an attribute set, the action *default* " "will not over write it::" msgstr "" "Si el espacio de nombres de destino ya tiene un atributo establecido, la " "acción *default* no lo sobrescribirá:" #: ../Doc/library/argparse.rst:1091 msgid "" "If the ``default`` value is a string, the parser parses the value as if it " "were a command-line argument. In particular, the parser applies any type_ " "conversion argument, if provided, before setting the attribute on the :class:" "`Namespace` return value. Otherwise, the parser uses the value as is::" msgstr "" "Si el valor ``default`` es una cadena de caracteres, el analizador procesa " "el valor como si fuera un argumento de la línea de comandos. En particular, " "el analizador aplica cualquier argumento de conversión type_ , si se " "proporciona, antes de establecer el atributo en el valor de retorno :class:" "`Namespace`. En caso contrario, el analizador utiliza el valor tal y como " "es::" #: ../Doc/library/argparse.rst:1102 msgid "" "For positional arguments with nargs_ equal to ``?`` or ``*``, the " "``default`` value is used when no command-line argument was present::" msgstr "" "Para argumentos posiciones con nargs_ igual a ``?`` o ``*``, el valor " "``default`` se utiliza cuando no hay ningún argumento de línea de comandos " "presente::" #: ../Doc/library/argparse.rst:1113 msgid "" "Providing ``default=argparse.SUPPRESS`` causes no attribute to be added if " "the command-line argument was not present::" msgstr "" "Proporcionar ``default=argparse.SUPPRESS`` causa que no se agregue ningún " "atributo si el argumento de la línea de comandos no está presente::" #: ../Doc/library/argparse.rst:1127 msgid "type" msgstr "*type*" #: ../Doc/library/argparse.rst:1129 msgid "" "By default, the parser reads command-line arguments in as simple strings. " "However, quite often the command-line string should instead be interpreted " "as another type, such as a :class:`float` or :class:`int`. The ``type`` " "keyword for :meth:`~ArgumentParser.add_argument` allows any necessary type-" "checking and type conversions to be performed." msgstr "" "De forma predeterminada, el analizador lee los argumentos de la línea de " "comandos como cadenas simples. Sin embargo, a menudo, la cadena de la línea " "de comandos debe interpretarse como otro tipo, como :class:`float` o :class:" "`int`. La palabra clave ``type`` para :meth:`~ArgumentParser.add_argument` " "permite realizar cualquier verificación de tipo y conversión de tipo " "necesaria." #: ../Doc/library/argparse.rst:1135 msgid "" "If the type_ keyword is used with the default_ keyword, the type converter " "is only applied if the default is a string." msgstr "" "Si la palabra clave type_ se usa con la palabra clave default_, el " "convertidor de tipos solo se aplica si el valor predeterminado es una cadena " "de caracteres." #: ../Doc/library/argparse.rst:1138 msgid "" "The argument to ``type`` can be any callable that accepts a single string. " "If the function raises :exc:`ArgumentTypeError`, :exc:`TypeError`, or :exc:" "`ValueError`, the exception is caught and a nicely formatted error message " "is displayed. No other exception types are handled." msgstr "" "El argumento para ``type`` puede ser cualquier invocable que acepte una sola " "cadena de caracteres. Si la función lanza :exc:`ArgumentTypeError`, :exc:" "`TypeError`, o :exc:`ValueError`, se detecta la excepción y se muestra un " "mensaje de error con un formato agradable. No se manejan otros tipos de " "excepciones." #: ../Doc/library/argparse.rst:1143 msgid "Common built-in types and functions can be used as type converters:" msgstr "" "Los tipos y funciones incorporados comunes se pueden utilizar como " "convertidores de tipos:" #: ../Doc/library/argparse.rst:1159 msgid "User defined functions can be used as well:" msgstr "Las funciones definidas por el usuario también se pueden utilizar:" #: ../Doc/library/argparse.rst:1171 msgid "" "The :func:`bool` function is not recommended as a type converter. All it " "does is convert empty strings to ``False`` and non-empty strings to " "``True``. This is usually not what is desired." msgstr "" "La función :func:`bool` no se recomienda como convertidor de tipos. Todo lo " "que hace es convertir cadenas de caracteres vacías en ``False`` y cadenas de " "caracteres no vacías en ``True``. Por lo general, esto no es lo que se desea." #: ../Doc/library/argparse.rst:1175 msgid "" "In general, the ``type`` keyword is a convenience that should only be used " "for simple conversions that can only raise one of the three supported " "exceptions. Anything with more interesting error-handling or resource " "management should be done downstream after the arguments are parsed." msgstr "" "En general, la palabra clave ``type`` es una conveniencia que solo debe " "usarse para conversiones simples que solo pueden generar una de las tres " "excepciones admitidas. Cualquier cosa con un manejo de errores o de recursos " "más interesante debe hacerse en sentido descendente después de analizar los " "argumentos." #: ../Doc/library/argparse.rst:1180 msgid "" "For example, JSON or YAML conversions have complex error cases that require " "better reporting than can be given by the ``type`` keyword. A :exc:`~json." "JSONDecodeError` would not be well formatted and a :exc:`FileNotFound` " "exception would not be handled at all." msgstr "" "Por ejemplo, las conversiones JSON o YAML tienen casos de error complejos " "que requieren mejores informes que los que puede proporcionar la palabra " "clave ``type``. Un :exc:`~json.JSONDecodeError` no estaría bien formateado y " "una excepción :exc:`FileNotFound` no se manejaría en absoluto." #: ../Doc/library/argparse.rst:1185 msgid "" "Even :class:`~argparse.FileType` has its limitations for use with the " "``type`` keyword. If one argument uses *FileType* and then a subsequent " "argument fails, an error is reported but the file is not automatically " "closed. In this case, it would be better to wait until after the parser has " "run and then use the :keyword:`with`-statement to manage the files." msgstr "" "Even :class:`~argparse.FileType` tiene sus limitaciones para su uso con la " "palabra clave ``type``. Si un argumento usa *FileType* y luego falla un " "argumento posterior, se informa un error pero el archivo no se cierra " "automáticamente. En este caso, sería mejor esperar hasta que se haya " "ejecutado el analizador y luego usar la declaración :keyword:`with` para " "administrar los archivos." #: ../Doc/library/argparse.rst:1191 msgid "" "For type checkers that simply check against a fixed set of values, consider " "using the choices_ keyword instead." msgstr "" "Para los verificadores de tipo que simplemente verifican un conjunto fijo de " "valores, considere usar la palabra clave choice_ en su lugar." #: ../Doc/library/argparse.rst:1198 msgid "choices" msgstr "*choices*" #: ../Doc/library/argparse.rst:1200 msgid "" "Some command-line arguments should be selected from a restricted set of " "values. These can be handled by passing a container object as the *choices* " "keyword argument to :meth:`~ArgumentParser.add_argument`. When the command " "line is parsed, argument values will be checked, and an error message will " "be displayed if the argument was not one of the acceptable values::" msgstr "" "Algunos argumentos de la línea de comandos deberían seleccionarse de un " "conjunto restringido de valores. Estos pueden ser manejados pasando un " "objeto contenedor como el argumento de palabra clave *choices* a :meth:" "`~ArgumentParser.add_argument`. Cuando se analiza la línea de comandos, se " "comprueban los valores de los argumentos y se muestra un mensaje de error si " "el argumento no era uno de los valores aceptables::" #: ../Doc/library/argparse.rst:1215 msgid "" "Note that inclusion in the *choices* container is checked after any type_ " "conversions have been performed, so the type of the objects in the *choices* " "container should match the type_ specified::" msgstr "" "Ten en cuenta que la inclusión en el contenedor *choices* se comprueba " "después de que se haya realizado cualquier conversión de type_, por lo que " "el tipo de los objetos del contenedor *choices* debe coincidir con el type_ " "especificado::" #: ../Doc/library/argparse.rst:1227 msgid "" "Any container can be passed as the *choices* value, so :class:`list` " "objects, :class:`set` objects, and custom containers are all supported." msgstr "" "Se puede pasar cualquier contenedor como el valor para *choices*, así que " "los objetos :class:`list`, :class:`set` , y los contenedores personalizados " "están todos soportados." #: ../Doc/library/argparse.rst:1230 msgid "" "Use of :class:`enum.Enum` is not recommended because it is difficult to " "control its appearance in usage, help, and error messages." msgstr "" "No se recomienda el uso de :class:`enum.Enum` porque es difícil controlar su " "apariencia en el uso, la ayuda y los mensajes de error." #: ../Doc/library/argparse.rst:1233 #, fuzzy msgid "" "Formatted choices override the default *metavar* which is normally derived " "from *dest*. This is usually what you want because the user never sees the " "*dest* parameter. If this display isn't desirable (perhaps because there " "are many choices), just specify an explicit metavar_." msgstr "" "Las opciones formateadas anulan el *metavar* predeterminado que normalmente " "se deriva de *dest*. Esto suele ser lo que desea porque el usuario nunca ve " "el parámetro *dest*. Si esta visualización no es deseable (quizás porque hay " "muchas opciones), simplemente especifique un metavar_ explícito." #: ../Doc/library/argparse.rst:1242 msgid "required" msgstr "*required*" #: ../Doc/library/argparse.rst:1244 msgid "" "In general, the :mod:`argparse` module assumes that flags like ``-f`` and " "``--bar`` indicate *optional* arguments, which can always be omitted at the " "command line. To make an option *required*, ``True`` can be specified for " "the ``required=`` keyword argument to :meth:`~ArgumentParser.add_argument`::" msgstr "" "En general, el módulo :mod:`argparse` asume que los indicadores (*flags*) " "como ``-f`` y ``--bar`` señalan argumentos *opcionales*, que siempre pueden " "ser omitidos en la línea de comandos. Para hacer una opción *requerida*, se " "puede especificar``True`` para el argumento de palabra clave``required=`` " "en :meth:`~ArgumentParser.add_argument`::" #: ../Doc/library/argparse.rst:1257 msgid "" "As the example shows, if an option is marked as ``required``, :meth:" "`~ArgumentParser.parse_args` will report an error if that option is not " "present at the command line." msgstr "" "Como muestra el ejemplo, si una opción está marcada como ``required``, :meth:" "`~ArgumentParser.parse_args` informará de un error si esa opción no está " "presente en la línea de comandos." #: ../Doc/library/argparse.rst:1263 msgid "" "Required options are generally considered bad form because users expect " "*options* to be *optional*, and thus they should be avoided when possible." msgstr "" "Las opciones requeridas están consideradas generalmente mala práctica porque " "los usuarios esperan que las *opciones* sean *opcionales*, y por lo tanto " "deberían ser evitadas cuando sea posible." #: ../Doc/library/argparse.rst:1270 msgid "help" msgstr "*help*" #: ../Doc/library/argparse.rst:1272 msgid "" "The ``help`` value is a string containing a brief description of the " "argument. When a user requests help (usually by using ``-h`` or ``--help`` " "at the command line), these ``help`` descriptions will be displayed with " "each argument::" msgstr "" "El valor ``help`` es una cadena de caracteres que contiene una breve " "descripción del argumento. Cuando un usuario solicita ayuda (normalmente " "usando ``-h`` o ``--help`` en la línea de comandos), estas descripciones " "``help`` se mostrarán con cada argumento::" #: ../Doc/library/argparse.rst:1292 #, python-format msgid "" "The ``help`` strings can include various format specifiers to avoid " "repetition of things like the program name or the argument default_. The " "available specifiers include the program name, ``%(prog)s`` and most keyword " "arguments to :meth:`~ArgumentParser.add_argument`, e.g. ``%(default)s``, " "``%(type)s``, etc.::" msgstr "" "Las cadenas de texto ``help`` pueden incluir varios descriptores de formato " "para evitar la repetición de cosas como el nombre del programa o el " "argumento default_. Los descriptores disponibles incluyen el nombre del " "programa, ``%(prog)s`` y la mayoría de los argumentos de palabra clave de :" "meth:`~ArgumentParser.add_argument`, por ejemplo ``%(default)s``, " "``%(type)s``, etc.::" #: ../Doc/library/argparse.rst:1309 #, python-format msgid "" "As the help string supports %-formatting, if you want a literal ``%`` to " "appear in the help string, you must escape it as ``%%``." msgstr "" "Como la cadena de caracteres de ayuda soporta el formato-%, si quieres que " "aparezca un ``%`` literal en la ayuda, debes escribirlo como ``%%``." #: ../Doc/library/argparse.rst:1312 msgid "" ":mod:`argparse` supports silencing the help entry for certain options, by " "setting the ``help`` value to ``argparse.SUPPRESS``::" msgstr "" ":mod:`argparse` soporta el silenciar la ayuda para ciertas opciones, " "ajustando el valor ``help`` a ``argparse.SUPPRESS``::" #: ../Doc/library/argparse.rst:1327 msgid "metavar" msgstr "*metavar*" #: ../Doc/library/argparse.rst:1329 msgid "" "When :class:`ArgumentParser` generates help messages, it needs some way to " "refer to each expected argument. By default, ArgumentParser objects use the " "dest_ value as the \"name\" of each object. By default, for positional " "argument actions, the dest_ value is used directly, and for optional " "argument actions, the dest_ value is uppercased. So, a single positional " "argument with ``dest='bar'`` will be referred to as ``bar``. A single " "optional argument ``--foo`` that should be followed by a single command-line " "argument will be referred to as ``FOO``. An example::" msgstr "" "Cuando :class:`ArgumentParser` genera mensajes de ayuda, necesita alguna " "forma de referirse a cada argumento esperado. Por defecto, los objetos " "*ArgumentParser* utilizan el valor dest_ como \"nombre\" de cada objeto. Por " "defecto, para las acciones de argumento posicional, el valor dest_ se " "utiliza directamente, y para las acciones de argumento opcional, el valor " "dest_ está en mayúsculas. Así, un único argumento posicional con " "``dest='bar'`` se denominará ``bar``. Un único argumento opcional ``--foo`` " "que debería seguirse por un único argumento de línea de comandos se " "denominará ``FOO``. Un ejemplo::" #: ../Doc/library/argparse.rst:1353 msgid "An alternative name can be specified with ``metavar``::" msgstr "Un nombre alternativo se puede especificar con ``metavar``::" #: ../Doc/library/argparse.rst:1370 msgid "" "Note that ``metavar`` only changes the *displayed* name - the name of the " "attribute on the :meth:`~ArgumentParser.parse_args` object is still " "determined by the dest_ value." msgstr "" "Ten en cuenta que ``metavar`` sólo cambia el nombre *mostrado* - el nombre " "del atributo en el objeto :meth:`~ArgumentParser.parse_args` sigue estando " "determinado por el valor dest_." #: ../Doc/library/argparse.rst:1374 msgid "" "Different values of ``nargs`` may cause the metavar to be used multiple " "times. Providing a tuple to ``metavar`` specifies a different display for " "each of the arguments::" msgstr "" "Diferentes valores de ``nargs`` pueden causar que *metavar* sea usado " "múltiples veces. Proporcionar una tupla a ``metavar`` especifica una " "visualización diferente para cada uno de los argumentos::" #: ../Doc/library/argparse.rst:1393 msgid "dest" msgstr "*dest*" #: ../Doc/library/argparse.rst:1395 msgid "" "Most :class:`ArgumentParser` actions add some value as an attribute of the " "object returned by :meth:`~ArgumentParser.parse_args`. The name of this " "attribute is determined by the ``dest`` keyword argument of :meth:" "`~ArgumentParser.add_argument`. For positional argument actions, ``dest`` " "is normally supplied as the first argument to :meth:`~ArgumentParser." "add_argument`::" msgstr "" "La mayoría de las acciones :class:`ArgumentParser` añaden algún valor como " "atributo del objeto retornado por :meth:`~ArgumentParser.parse_args`. El " "nombre de este atributo está determinado por el argumento de palabra clave " "``dest`` de :meth:`~ArgumentParser.add_argument`. Para acciones de argumento " "posicional, se proporciona ``dest`` normalmente como primer argumento de :" "meth:`~ArgumentParser.add_argument`::" #: ../Doc/library/argparse.rst:1407 msgid "" "For optional argument actions, the value of ``dest`` is normally inferred " "from the option strings. :class:`ArgumentParser` generates the value of " "``dest`` by taking the first long option string and stripping away the " "initial ``--`` string. If no long option strings were supplied, ``dest`` " "will be derived from the first short option string by stripping the initial " "``-`` character. Any internal ``-`` characters will be converted to ``_`` " "characters to make sure the string is a valid attribute name. The examples " "below illustrate this behavior::" msgstr "" "Para las acciones de argumentos opcionales, el valor de ``dest`` se infiere " "normalmente de las cadenas de caracteres de opción. :class:`ArgumentParser` " "genera el valor de ``dest`` tomando la primera cadena de caracteres de " "opción larga y quitando la cadena inicial ``--``. Si no se proporcionaron " "cadenas de caracteres de opción largas, ``dest`` se derivará de la primera " "cadena de caracteres de opción corta quitando el carácter ``-``. Cualquier " "carácter ``-`` interno se convertirá a caracteres ``_`` para asegurarse de " "que la cadena de caracteres es un nombre de atributo válido. Los ejemplos " "siguientes ilustran este comportamiento::" #: ../Doc/library/argparse.rst:1424 msgid "``dest`` allows a custom attribute name to be provided::" msgstr "" "``dest`` permite que se proporcione un nombre de atributo personalizado::" #: ../Doc/library/argparse.rst:1432 msgid "Action classes" msgstr "Las clases *Action*" #: ../Doc/library/argparse.rst:1434 msgid "" "Action classes implement the Action API, a callable which returns a callable " "which processes arguments from the command-line. Any object which follows " "this API may be passed as the ``action`` parameter to :meth:`add_argument`." msgstr "" "Las clases *Action* implementan la API de *Action*, un invocable que retorna " "un invocable que procesa los argumentos de la línea de comandos. Cualquier " "objeto que siga esta API puede ser pasado como el parámetro ``action`` a :" "meth:`add_argument`." #: ../Doc/library/argparse.rst:1443 msgid "" "Action objects are used by an ArgumentParser to represent the information " "needed to parse a single argument from one or more strings from the command " "line. The Action class must accept the two positional arguments plus any " "keyword arguments passed to :meth:`ArgumentParser.add_argument` except for " "the ``action`` itself." msgstr "" "Los objetos *Action* son utilizados por un *ArgumentParser* para representar " "la información necesaria para analizar un sólo argumento de una o más " "cadenas de caracteres de la línea de comandos. La clase *Action* debe " "aceptar los dos argumentos de posición más cualquier argumento de palabra " "clave pasado a :meth:`ArgumentParser.add_argument` excepto para la propia " "``action``." #: ../Doc/library/argparse.rst:1449 msgid "" "Instances of Action (or return value of any callable to the ``action`` " "parameter) should have attributes \"dest\", \"option_strings\", \"default\", " "\"type\", \"required\", \"help\", etc. defined. The easiest way to ensure " "these attributes are defined is to call ``Action.__init__``." msgstr "" "Las instancias de *Action* (o el valor de retorno de cualquier invocable al " "parámetro ``action`` ) deben tener definidos los atributos *”dest”*, " "*”option_strings”*, *”default”*, *”type”*, *”required”*, *”help”*, etc. La " "forma más fácil de asegurar que estos atributos estén definidos es llamar a " "``Action.__init__``." #: ../Doc/library/argparse.rst:1454 msgid "" "Action instances should be callable, so subclasses must override the " "``__call__`` method, which should accept four parameters:" msgstr "" "Las instancias de *Action* deben ser invocables, por lo que las subclases " "deben anular el método ``__call__``, que debería aceptar cuatro parámetros:" #: ../Doc/library/argparse.rst:1457 msgid "``parser`` - The ArgumentParser object which contains this action." msgstr "``parser`` - El objeto *ArgumentParser* que contiene esta acción." #: ../Doc/library/argparse.rst:1459 msgid "" "``namespace`` - The :class:`Namespace` object that will be returned by :meth:" "`~ArgumentParser.parse_args`. Most actions add an attribute to this object " "using :func:`setattr`." msgstr "" "``namespace`` - El objeto :class:`Namespace` que será retornado por :meth:" "`~ArgumentParser.parse_args`. La mayoría de las acciones añaden un atributo " "a este objeto usando :func:`setattr`." #: ../Doc/library/argparse.rst:1463 msgid "" "``values`` - The associated command-line arguments, with any type " "conversions applied. Type conversions are specified with the type_ keyword " "argument to :meth:`~ArgumentParser.add_argument`." msgstr "" "``values`` - Los argumentos de la línea de comandos asociados, con cualquier " "tipo de conversión aplicada. Las conversiones de tipos se especifican con el " "argumento de palabra clave type_ a :meth:`~ArgumentParser.add_argument`." #: ../Doc/library/argparse.rst:1467 msgid "" "``option_string`` - The option string that was used to invoke this action. " "The ``option_string`` argument is optional, and will be absent if the action " "is associated with a positional argument." msgstr "" "``option_string`` - La cadena de caracteres de opción que se usó para " "invocar esta acción. El argumento ``option_string`` es opcional, y estará " "ausente si la acción está asociada a un argumento de posición." #: ../Doc/library/argparse.rst:1471 msgid "" "The ``__call__`` method may perform arbitrary actions, but will typically " "set attributes on the ``namespace`` based on ``dest`` and ``values``." msgstr "" "El método ``__call__`` puede realizar acciones arbitrarias, pero típicamente " "estable atributos en ``namespace`` basados en ``dest`` y ``values``." #: ../Doc/library/argparse.rst:1474 msgid "" "Action subclasses can define a ``format_usage`` method that takes no " "argument and return a string which will be used when printing the usage of " "the program. If such method is not provided, a sensible default will be used." msgstr "" "Las subclases de acción pueden definir un método ``format_usage`` que no " "toma ningún argumento y devuelve una cadena que se utilizará al imprimir el " "uso del programa. Si no se proporciona dicho método, se utilizará un valor " "predeterminado razonable." #: ../Doc/library/argparse.rst:1479 msgid "The parse_args() method" msgstr "El método *parse_args()*" #: ../Doc/library/argparse.rst:1483 msgid "" "Convert argument strings to objects and assign them as attributes of the " "namespace. Return the populated namespace." msgstr "" "Convierte las cadenas de caracteres de argumentos en objetos y los asigna " "como atributos del espacio de nombres (*namespace*). Retorna el espacio de " "nombres (*namespace*) ocupado." #: ../Doc/library/argparse.rst:1486 msgid "" "Previous calls to :meth:`add_argument` determine exactly what objects are " "created and how they are assigned. See the documentation for :meth:" "`add_argument` for details." msgstr "" "Las llamadas previas a :meth:`add_argument` determinan exactamente qué " "objetos se crean y cómo se asignan. Mira la documentación de :meth:" "`add_argument` para más detalles." #: ../Doc/library/argparse.rst:1490 msgid "" "args_ - List of strings to parse. The default is taken from :data:`sys." "argv`." msgstr "" "args_ - Lista de cadenas de caracteres para analizar. El valor por defecto " "se toma de :data:`sys.argv`." #: ../Doc/library/argparse.rst:1493 msgid "" "namespace_ - An object to take the attributes. The default is a new empty :" "class:`Namespace` object." msgstr "" "namespace_ - Un objeto para obtener los atributos. Por defecto es un nuevo " "objeto vacío :class:`Namespace`." #: ../Doc/library/argparse.rst:1498 msgid "Option value syntax" msgstr "Sintaxis del valor de la opción" #: ../Doc/library/argparse.rst:1500 msgid "" "The :meth:`~ArgumentParser.parse_args` method supports several ways of " "specifying the value of an option (if it takes one). In the simplest case, " "the option and its value are passed as two separate arguments::" msgstr "" "El método :meth:`~ArgumentParser.parse_args` soporta diversas formas de " "especificar el valor de una opción (si requiere uno). En el caso más simple, " "la opción y su valor se pasan como dos argumentos separados::" #: ../Doc/library/argparse.rst:1512 msgid "" "For long options (options with names longer than a single character), the " "option and value can also be passed as a single command-line argument, using " "``=`` to separate them::" msgstr "" "En el caso de opciones largas (opciones con nombres más largos que un sólo " "carácter), la opción y el valor también se pueden pasar como un sólo " "argumento de línea de comandos, utilizando ``=`` para separarlos::" #: ../Doc/library/argparse.rst:1519 msgid "" "For short options (options only one character long), the option and its " "value can be concatenated::" msgstr "" "Para las opciones cortas (opciones de un sólo carácter de largo), la opción " "y su valor pueden ser concatenados::" #: ../Doc/library/argparse.rst:1525 msgid "" "Several short options can be joined together, using only a single ``-`` " "prefix, as long as only the last option (or none of them) requires a value::" msgstr "" "Se pueden unir varias opciones cortas, usando un sólo prefijo ``-``, siempre " "y cuando sólo la última opción (o ninguna de ellas) requiera un valor::" #: ../Doc/library/argparse.rst:1537 msgid "Invalid arguments" msgstr "Argumentos no válidos" #: ../Doc/library/argparse.rst:1539 msgid "" "While parsing the command line, :meth:`~ArgumentParser.parse_args` checks " "for a variety of errors, including ambiguous options, invalid types, invalid " "options, wrong number of positional arguments, etc. When it encounters such " "an error, it exits and prints the error along with a usage message::" msgstr "" "Mientras analiza la línea de comandos, :meth:`~ArgumentParser.parse_args` " "comprueba una variedad de errores, incluyendo opciones ambiguas, tipos no " "válidos, opciones no válidas, número incorrecto de argumentos de posición, " "etc. Cuando encuentra un error de este tipo, termina y muestra el error " "junto con un mensaje de uso::" #: ../Doc/library/argparse.rst:1565 msgid "Arguments containing ``-``" msgstr "Argumentos conteniendo ``-``" #: ../Doc/library/argparse.rst:1567 msgid "" "The :meth:`~ArgumentParser.parse_args` method attempts to give errors " "whenever the user has clearly made a mistake, but some situations are " "inherently ambiguous. For example, the command-line argument ``-1`` could " "either be an attempt to specify an option or an attempt to provide a " "positional argument. The :meth:`~ArgumentParser.parse_args` method is " "cautious here: positional arguments may only begin with ``-`` if they look " "like negative numbers and there are no options in the parser that look like " "negative numbers::" msgstr "" "El método :meth:`~ArgumentParser.parse_args` busca generar errores cuando el " "usuario ha cometido claramente una equivocación, pero algunas situaciones " "son inherentemente ambiguas. Por ejemplo, el argumento de línea de comandos " "``-1`` podría ser un intento de especificar una opción o un intento de " "proporcionar un argumento de posición. El método :meth:`~ArgumentParser." "parse_args` es cauteloso aquí: los argumentos de posición sólo pueden " "comenzar con ``-`` si se ven como números negativos y no hay opciones en el " "analizador que se puedan ver como números negativos ::" #: ../Doc/library/argparse.rst:1605 msgid "" "If you have positional arguments that must begin with ``-`` and don't look " "like negative numbers, you can insert the pseudo-argument ``'--'`` which " "tells :meth:`~ArgumentParser.parse_args` that everything after that is a " "positional argument::" msgstr "" "Si tienes argumentos de posición que deben comenzar con ``-`` y no parecen " "números negativos, puedes insertar el pseudo-argumento ``'--'`` que indica " "a :meth:`~ArgumentParser.parse_args` que todo lo que sigue es un argumento " "de posición::" #: ../Doc/library/argparse.rst:1616 msgid "Argument abbreviations (prefix matching)" msgstr "Abreviaturas de los argumentos (coincidencia de prefijos)" #: ../Doc/library/argparse.rst:1618 msgid "" "The :meth:`~ArgumentParser.parse_args` method :ref:`by default " "` allows long options to be abbreviated to a prefix, if the " "abbreviation is unambiguous (the prefix matches a unique option)::" msgstr "" "El método :meth:`~ArgumentParser.parse_args` :ref:`por defecto " "` permite abreviar las opciones largas a un prefijo, si la " "abreviatura es inequívoca (el prefijo coincide con una opción única)::" #: ../Doc/library/argparse.rst:1633 msgid "" "An error is produced for arguments that could produce more than one options. " "This feature can be disabled by setting :ref:`allow_abbrev` to ``False``." msgstr "" "Se incurre en un error por argumentos que podrían derivar en más de una " "opción. Esta característica puede ser desactivada poniendo :ref:" "`allow_abbrev` a ``False``." #: ../Doc/library/argparse.rst:1639 msgid "Beyond ``sys.argv``" msgstr "Más allá de ``sys.argv``" #: ../Doc/library/argparse.rst:1641 msgid "" "Sometimes it may be useful to have an ArgumentParser parse arguments other " "than those of :data:`sys.argv`. This can be accomplished by passing a list " "of strings to :meth:`~ArgumentParser.parse_args`. This is useful for " "testing at the interactive prompt::" msgstr "" "A veces puede ser útil tener un *ArgumentParser* analizando argumentos que " "no sean los de :data:`sys.argv`. Esto se puede lograr pasando una lista de " "cadenas de caracteres a :meth:`~ArgumentParser.parse_args`. Esto es útil " "para probar en el *prompt* interactivo::" #: ../Doc/library/argparse.rst:1661 msgid "The Namespace object" msgstr "El objeto *Namespace*" #: ../Doc/library/argparse.rst:1665 msgid "" "Simple class used by default by :meth:`~ArgumentParser.parse_args` to create " "an object holding attributes and return it." msgstr "" "Clase simple utilizada por defecto por :meth:`~ArgumentParser.parse_args` " "para crear un objeto que contenga atributos y retornarlo." #: ../Doc/library/argparse.rst:1668 msgid "" "This class is deliberately simple, just an :class:`object` subclass with a " "readable string representation. If you prefer to have dict-like view of the " "attributes, you can use the standard Python idiom, :func:`vars`::" msgstr "" "Esta clase es deliberadamente simple, sólo una subclase :class:`object` con " "una representación de cadena de texto legible. Si prefieres tener una vista " "en forma de diccionario de los atributos, puedes usar el lenguaje estándar " "de Python, :func:`vars`::" #: ../Doc/library/argparse.rst:1678 msgid "" "It may also be useful to have an :class:`ArgumentParser` assign attributes " "to an already existing object, rather than a new :class:`Namespace` object. " "This can be achieved by specifying the ``namespace=`` keyword argument::" msgstr "" "También puede ser útil tener un :class:`ArgumentParser` que asigne atributos " "a un objeto ya existente, en lugar de un nuevo objeto :class:`Namespace`. " "Esto se puede lograr especificando el argumento de palabra clave " "``namespace=``::" #: ../Doc/library/argparse.rst:1694 msgid "Other utilities" msgstr "Otras utilidades" #: ../Doc/library/argparse.rst:1697 msgid "Sub-commands" msgstr "Sub-comandos" #: ../Doc/library/argparse.rst:1704 msgid "" "Many programs split up their functionality into a number of sub-commands, " "for example, the ``svn`` program can invoke sub-commands like ``svn " "checkout``, ``svn update``, and ``svn commit``. Splitting up functionality " "this way can be a particularly good idea when a program performs several " "different functions which require different kinds of command-line " "arguments. :class:`ArgumentParser` supports the creation of such sub-" "commands with the :meth:`add_subparsers` method. The :meth:`add_subparsers` " "method is normally called with no arguments and returns a special action " "object. This object has a single method, :meth:`~ArgumentParser." "add_parser`, which takes a command name and any :class:`ArgumentParser` " "constructor arguments, and returns an :class:`ArgumentParser` object that " "can be modified as usual." msgstr "" "Muchos programas dividen su funcionalidad en varios sub-comandos, por " "ejemplo, el programa ``svn`` puede llamar sub-comandos como ``svn " "checkout``, ``svn update``, y ``svn commit``. Dividir la funcionalidad de " "esta forma puede ser una idea particularmente buena cuando un programa " "realiza varias funciones diferentes que requieren diferentes tipos de " "argumentos en la línea de comandos. :class:`ArgumentParser` soporta la " "creación de tales sub-comandos con el método :meth:`add_subparsers`. El " "método :meth:`add_subparsers` se llama normalmente sin argumentos y retorna " "un objeto de acción especial. Este objeto tiene un único método, :meth:" "`~ArgumentParser.add_parser`, que toma un nombre de comando y cualquier " "argumento de construcción :class:`ArgumentParser`, y retorna un objeto :" "class:`ArgumentParser` que puede ser modificado de la forma habitual." #: ../Doc/library/argparse.rst:1716 msgid "Description of parameters:" msgstr "Descripción de los parámetros:" #: ../Doc/library/argparse.rst:1718 msgid "" "title - title for the sub-parser group in help output; by default " "\"subcommands\" if description is provided, otherwise uses title for " "positional arguments" msgstr "" "*title* - título para el grupo del analizador secundario en la salida de la " "ayuda; por defecto *\"subcommands\"* si se proporciona la descripción, de lo " "contrario utiliza el título para los argumentos de posición" #: ../Doc/library/argparse.rst:1722 msgid "" "description - description for the sub-parser group in help output, by " "default ``None``" msgstr "" "*description* - descripción para el grupo del analizador secundario en la " "salida de la ayuda, por defecto ``None``" #: ../Doc/library/argparse.rst:1725 msgid "" "prog - usage information that will be displayed with sub-command help, by " "default the name of the program and any positional arguments before the " "subparser argument" msgstr "" "*prog* - información de uso que se mostrará con la ayuda de los sub-" "comandos, por defecto el nombre del programa y cualquier argumento de " "posición antes del argumento del analizador secundario" #: ../Doc/library/argparse.rst:1729 msgid "" "parser_class - class which will be used to create sub-parser instances, by " "default the class of the current parser (e.g. ArgumentParser)" msgstr "" "*parser_class* - clase que se usará para crear instancias de análisis " "secundario, por defecto la clase del analizador actual (por ejemplo, " "ArgumentParser)" #: ../Doc/library/argparse.rst:1732 msgid "" "action_ - the basic type of action to be taken when this argument is " "encountered at the command line" msgstr "" "action_ - el tipo básico de acción a tomar cuando este argumento se " "encuentre en la línea de comandos" #: ../Doc/library/argparse.rst:1735 msgid "" "dest_ - name of the attribute under which sub-command name will be stored; " "by default ``None`` and no value is stored" msgstr "" "dest_ - nombre del atributo en el que se almacenará el nombre del sub-" "comando; por defecto ``None`` y no se almacena ningún valor" #: ../Doc/library/argparse.rst:1738 msgid "" "required_ - Whether or not a subcommand must be provided, by default " "``False`` (added in 3.7)" msgstr "" "required_ - Si se debe proporcionar o no un sub-comando, por defecto " "``False`` (añadido en 3.7)" #: ../Doc/library/argparse.rst:1741 msgid "help_ - help for sub-parser group in help output, by default ``None``" msgstr "" "help_ - ayuda para el grupo de análisis secundario en la salida de la ayuda, " "por defecto ``None``" #: ../Doc/library/argparse.rst:1743 msgid "" "metavar_ - string presenting available sub-commands in help; by default it " "is ``None`` and presents sub-commands in form {cmd1, cmd2, ..}" msgstr "" "metavar_ - cadena de caracteres que presenta los sub-comandos disponibles en " "la ayuda; por defecto es ``None`` y presenta los sub-comandos de la forma " "{cmd1, cmd2, ..}" #: ../Doc/library/argparse.rst:1746 msgid "Some example usage::" msgstr "Algún ejemplo de uso::" #: ../Doc/library/argparse.rst:1767 msgid "" "Note that the object returned by :meth:`parse_args` will only contain " "attributes for the main parser and the subparser that was selected by the " "command line (and not any other subparsers). So in the example above, when " "the ``a`` command is specified, only the ``foo`` and ``bar`` attributes are " "present, and when the ``b`` command is specified, only the ``foo`` and " "``baz`` attributes are present." msgstr "" "Ten en cuenta que el objeto retornado por :meth:`parse_args` sólo contendrá " "atributos para el analizador principal y el analizador secundario que fue " "seleccionado por la línea de comandos (y no cualquier otro analizador " "secundario). Así que en el ejemplo anterior, cuando se especifica el comando " "``a``, sólo están presentes los atributos ``foo`` y ``bar``, y cuando se " "especifica el comando``b``, sólo están presentes los atributos ``foo`` y " "``baz``." #: ../Doc/library/argparse.rst:1774 msgid "" "Similarly, when a help message is requested from a subparser, only the help " "for that particular parser will be printed. The help message will not " "include parent parser or sibling parser messages. (A help message for each " "subparser command, however, can be given by supplying the ``help=`` argument " "to :meth:`add_parser` as above.)" msgstr "" "Del mismo modo, cuando se solicita un mensaje de ayuda de un analizador " "secundario, sólo se imprimirá la ayuda para ese analizador en particular. El " "mensaje de ayuda no incluirá mensajes del analizador principal o de " "analizadores relacionados. (Sin embargo, se puede dar un mensaje de ayuda " "para cada comando del analizador secundario suministrando el argumento " "``help=`` a :meth:`add_parser` como se ha indicado anteriormente)." #: ../Doc/library/argparse.rst:1810 msgid "" "The :meth:`add_subparsers` method also supports ``title`` and " "``description`` keyword arguments. When either is present, the subparser's " "commands will appear in their own group in the help output. For example::" msgstr "" "El método :meth:`add_subparsers` también soporta los argumentos de palabra " "clave``title`` y ``description``. Cuando cualquiera de los dos esté " "presente, los comandos del analizador secundario aparecerán en su propio " "grupo en la salida de la ayuda. Por ejemplo::" #: ../Doc/library/argparse.rst:1831 msgid "" "Furthermore, ``add_parser`` supports an additional ``aliases`` argument, " "which allows multiple strings to refer to the same subparser. This example, " "like ``svn``, aliases ``co`` as a shorthand for ``checkout``::" msgstr "" "Además, ``add_parser`` soporta un argumento adicional ``aliases``, que " "permite que múltiples cadenas se refieran al mismo analizador secundario. " "Este ejemplo, algo del estilo ``svn``, alias ``co`` como abreviatura para " "``checkout``::" #: ../Doc/library/argparse.rst:1842 msgid "" "One particularly effective way of handling sub-commands is to combine the " "use of the :meth:`add_subparsers` method with calls to :meth:`set_defaults` " "so that each subparser knows which Python function it should execute. For " "example::" msgstr "" "Una forma particularmente efectiva de manejar los sub-comandos es combinar " "el uso del método :meth:`add_subparsers` con llamadas a :meth:`set_defaults` " "para que cada analizador secundario sepa qué función de Python debe " "ejecutar. Por ejemplo::" #: ../Doc/library/argparse.rst:1879 msgid "" "This way, you can let :meth:`parse_args` do the job of calling the " "appropriate function after argument parsing is complete. Associating " "functions with actions like this is typically the easiest way to handle the " "different actions for each of your subparsers. However, if it is necessary " "to check the name of the subparser that was invoked, the ``dest`` keyword " "argument to the :meth:`add_subparsers` call will work::" msgstr "" "De esta manera, puedes dejar que :meth:`parse_args` haga el trabajo de " "llamar a la función apropiada después de que el análisis de los argumentos " "se haya completado. Asociar funciones con acciones como esta es típicamente " "la forma más fácil de manejar las diferentes acciones para cada uno de tus " "analizadores secundarios. Sin embargo, si es necesario comprobar el nombre " "del analizador secundario que se ha invocado, el argumento de palabra clave " "``dest`` a la llamada :meth:`add_subparsers` hará el trabajo::" #: ../Doc/library/argparse.rst:1895 msgid "New *required* keyword argument." msgstr "Nuevo argumento de palabra clave *required*." #: ../Doc/library/argparse.rst:1900 msgid "FileType objects" msgstr "Objetos *FileType*" #: ../Doc/library/argparse.rst:1904 msgid "" "The :class:`FileType` factory creates objects that can be passed to the type " "argument of :meth:`ArgumentParser.add_argument`. Arguments that have :class:" "`FileType` objects as their type will open command-line arguments as files " "with the requested modes, buffer sizes, encodings and error handling (see " "the :func:`open` function for more details)::" msgstr "" "El generador :class:`FileType` crea objetos que pueden ser transferidos al " "argumento tipo de :meth:`ArgumentParser.add_argument`. Los argumentos que " "tienen objetos :class:`FileType` como su tipo abrirán los argumentos de " "líneas de comandos como archivos con los modos, tamaños de búfer, " "codificaciones y manejo de errores solicitados (véase la función :func:" "`open` para más detalles)::" #: ../Doc/library/argparse.rst:1916 msgid "" "FileType objects understand the pseudo-argument ``'-'`` and automatically " "convert this into ``sys.stdin`` for readable :class:`FileType` objects and " "``sys.stdout`` for writable :class:`FileType` objects::" msgstr "" "Los objetos *FileType* entienden el pseudo-argumento ``'-'`` y lo convierten " "automáticamente en ``sys.stdin`` para objetos de lectura :class:`FileType` y " "``sys.stdout`` para objetos de escritura :class:`FileType`::" #: ../Doc/library/argparse.rst:1925 msgid "The *encodings* and *errors* keyword arguments." msgstr "Los argumentos de palabra clave *encodings* y *errors*." #: ../Doc/library/argparse.rst:1930 msgid "Argument groups" msgstr "Grupos de argumentos" #: ../Doc/library/argparse.rst:1934 msgid "" "By default, :class:`ArgumentParser` groups command-line arguments into " "\"positional arguments\" and \"optional arguments\" when displaying help " "messages. When there is a better conceptual grouping of arguments than this " "default one, appropriate groups can be created using the :meth:" "`add_argument_group` method::" msgstr "" "Por defecto, :class:`ArgumentParser` agrupa los argumentos de la línea de " "comandos en \"argumentos de posición\" y \"argumentos opcionales\" al " "mostrar los mensajes de ayuda. Cuando hay una mejor agrupación conceptual de " "argumentos que esta predeterminada, se pueden crear grupos apropiados usando " "el método :meth:`add_argument_group`::" #: ../Doc/library/argparse.rst:1951 msgid "" "The :meth:`add_argument_group` method returns an argument group object which " "has an :meth:`~ArgumentParser.add_argument` method just like a regular :" "class:`ArgumentParser`. When an argument is added to the group, the parser " "treats it just like a normal argument, but displays the argument in a " "separate group for help messages. The :meth:`add_argument_group` method " "accepts *title* and *description* arguments which can be used to customize " "this display::" msgstr "" "El método :meth:`add_argument_group` retorna un objeto de grupo de " "argumentos que tiene un método :meth:`~ArgumentParser.add_argument` igual " "que un :class:`ArgumentParser` convencional. Cuando se añade un argumento al " "grupo, el analizador lo trata como un argumento cualquiera, pero presenta el " "argumento en un grupo aparte para los mensajes de ayuda. El método :meth:" "`add_argument_group` acepta los argumentos *title* y *description* que " "pueden ser usados para personalizar esta presentación::" #: ../Doc/library/argparse.rst:1977 msgid "" "Note that any arguments not in your user-defined groups will end up back in " "the usual \"positional arguments\" and \"optional arguments\" sections." msgstr "" "Ten en cuenta que cualquier argumento que no esté en los grupos definidos " "por el usuario terminará en las secciones habituales de \"argumentos de " "posición\" y \"argumentos opcionales\"." #: ../Doc/library/argparse.rst:1980 msgid "" "Calling :meth:`add_argument_group` on an argument group is deprecated. This " "feature was never supported and does not always work correctly. The function " "exists on the API by accident through inheritance and will be removed in the " "future." msgstr "" #: ../Doc/library/argparse.rst:1988 msgid "Mutual exclusion" msgstr "Exclusión mutua" #: ../Doc/library/argparse.rst:1992 msgid "" "Create a mutually exclusive group. :mod:`argparse` will make sure that only " "one of the arguments in the mutually exclusive group was present on the " "command line::" msgstr "" "Crear un grupo de exclusividad mutua. :mod:`argparse` se asegurará de que " "sólo uno de los argumentos del grupo de exclusividad mutua esté presente en " "la línea de comandos::" #: ../Doc/library/argparse.rst:2008 msgid "" "The :meth:`add_mutually_exclusive_group` method also accepts a *required* " "argument, to indicate that at least one of the mutually exclusive arguments " "is required::" msgstr "" "El método :meth:`add_mutually_exclusive_group` también acepta un argumento " "*required*, para indicar que se requiere al menos uno de los argumentos " "mutuamente exclusivos::" #: ../Doc/library/argparse.rst:2020 msgid "" "Note that currently mutually exclusive argument groups do not support the " "*title* and *description* arguments of :meth:`~ArgumentParser." "add_argument_group`." msgstr "" "Ten en cuenta que actualmente los grupos de argumentos mutuamente exclusivos " "no admiten los argumentos *title* y *description* de :meth:`~ArgumentParser." "add_argument_group`." #: ../Doc/library/argparse.rst:2024 msgid "" "Calling :meth:`add_argument_group` or :meth:`add_mutually_exclusive_group` " "on a mutually exclusive group is deprecated. These features were never " "supported and do not always work correctly. The functions exist on the API " "by accident through inheritance and will be removed in the future." msgstr "" #: ../Doc/library/argparse.rst:2032 msgid "Parser defaults" msgstr "Valores por defecto del analizador" #: ../Doc/library/argparse.rst:2036 msgid "" "Most of the time, the attributes of the object returned by :meth:" "`parse_args` will be fully determined by inspecting the command-line " "arguments and the argument actions. :meth:`set_defaults` allows some " "additional attributes that are determined without any inspection of the " "command line to be added::" msgstr "" "La mayoría de las veces, los atributos del objeto retornado por :meth:" "`parse_args` se determinarán completamente inspeccionando los argumentos de " "la línea de comandos y las acciones de los argumentos. :meth:`set_defaults` " "permite que se añadan algunos atributos adicionales que se determinan sin " "ninguna inspección de la línea de comandos::" #: ../Doc/library/argparse.rst:2048 msgid "" "Note that parser-level defaults always override argument-level defaults::" msgstr "" "Ten en cuenta que los valores por defecto a nivel analizador siempre " "prevalecen sobre los valores por defecto a nivel argumento::" #: ../Doc/library/argparse.rst:2056 msgid "" "Parser-level defaults can be particularly useful when working with multiple " "parsers. See the :meth:`~ArgumentParser.add_subparsers` method for an " "example of this type." msgstr "" "Los valores por defecto a nivel analizador pueden ser muy útiles cuando se " "trabaja con varios analizadores. Consulta el método :meth:`~ArgumentParser." "add_subparsers` para ver un ejemplo de este tipo." #: ../Doc/library/argparse.rst:2062 msgid "" "Get the default value for a namespace attribute, as set by either :meth:" "`~ArgumentParser.add_argument` or by :meth:`~ArgumentParser.set_defaults`::" msgstr "" "Obtiene el valor por defecto para un atributo del espacio de nombres " "(*namespace*), establecido ya sea por :meth:`~ArgumentParser.add_argument` o " "por :meth:`~ArgumentParser.set_defaults`::" #: ../Doc/library/argparse.rst:2073 msgid "Printing help" msgstr "Mostrando la ayuda" #: ../Doc/library/argparse.rst:2075 msgid "" "In most typical applications, :meth:`~ArgumentParser.parse_args` will take " "care of formatting and printing any usage or error messages. However, " "several formatting methods are available:" msgstr "" "En la mayoría de las aplicaciones típicas, :meth:`~ArgumentParser." "parse_args` se encargará de dar formato y mostrar cualquier mensaje de uso o " "de error. Sin embargo, hay varios métodos para dar formato disponibles:" #: ../Doc/library/argparse.rst:2081 msgid "" "Print a brief description of how the :class:`ArgumentParser` should be " "invoked on the command line. If *file* is ``None``, :data:`sys.stdout` is " "assumed." msgstr "" "Muestra una breve descripción de cómo se debe invocar el :class:" "`ArgumentParser` en la línea de comandos. Si *file* es ``None``, se asume :" "data:`sys.stdout`." #: ../Doc/library/argparse.rst:2087 msgid "" "Print a help message, including the program usage and information about the " "arguments registered with the :class:`ArgumentParser`. If *file* is " "``None``, :data:`sys.stdout` is assumed." msgstr "" "Muestra un mensaje de ayuda, incluyendo el uso del programa e información " "sobre los argumentos registrados en el :class:`ArgumentParser`. Si *file* es " "``None``, se asume :data:`sys.stdout`." #: ../Doc/library/argparse.rst:2091 msgid "" "There are also variants of these methods that simply return a string instead " "of printing it:" msgstr "" "También hay variantes de estos métodos que simplemente retornan una cadena " "de caracteres en lugar de mostrarla:" #: ../Doc/library/argparse.rst:2096 msgid "" "Return a string containing a brief description of how the :class:" "`ArgumentParser` should be invoked on the command line." msgstr "" "Retorna una cadena de caracteres que contiene una breve descripción de cómo " "se debe invocar el :class:`ArgumentParser` en la línea de comandos." #: ../Doc/library/argparse.rst:2101 msgid "" "Return a string containing a help message, including the program usage and " "information about the arguments registered with the :class:`ArgumentParser`." msgstr "" "Retorna una cadena de caracteres que contiene un mensaje de ayuda, " "incluyendo el uso del programa e información sobre los argumentos " "registrados en el :class:`ArgumentParser`." #: ../Doc/library/argparse.rst:2106 msgid "Partial parsing" msgstr "Análisis parcial" #: ../Doc/library/argparse.rst:2110 msgid "" "Sometimes a script may only parse a few of the command-line arguments, " "passing the remaining arguments on to another script or program. In these " "cases, the :meth:`~ArgumentParser.parse_known_args` method can be useful. " "It works much like :meth:`~ArgumentParser.parse_args` except that it does " "not produce an error when extra arguments are present. Instead, it returns " "a two item tuple containing the populated namespace and the list of " "remaining argument strings." msgstr "" "A veces una secuencia de comandos (*script*) sólo puede analizar algunos de " "los argumentos de la línea de comandos, pasando el resto de los argumentos a " "otra secuencia o programa. En estos casos, el método :meth:`~ArgumentParser." "parse_known_args` puede ser útil. Funciona de forma muy parecida a :meth:" "`~ArgumentParser.parse_args` excepto que no produce un error cuando hay " "argumentos extra presentes. En lugar de ello, retorna una tupla de dos " "elementos que contiene el espacio de nombres ocupado y la lista de " "argumentos de cadena de caracteres restantes." #: ../Doc/library/argparse.rst:2126 msgid "" ":ref:`Prefix matching ` rules apply to :meth:" "`parse_known_args`. The parser may consume an option even if it's just a " "prefix of one of its known options, instead of leaving it in the remaining " "arguments list." msgstr "" ":ref:`Coincidencia de prefijos ` las reglas se aplican a :" "meth:`parse_known_args`. El analizador puede consumir una opción aunque sea " "sólo un prefijo de una de sus opciones conocidas, en lugar de dejarla en la " "lista de argumentos restantes." #: ../Doc/library/argparse.rst:2133 msgid "Customizing file parsing" msgstr "Personalizando el análisis de archivos" #: ../Doc/library/argparse.rst:2137 msgid "" "Arguments that are read from a file (see the *fromfile_prefix_chars* keyword " "argument to the :class:`ArgumentParser` constructor) are read one argument " "per line. :meth:`convert_arg_line_to_args` can be overridden for fancier " "reading." msgstr "" "Los argumentos que se leen de un archivo (mira el argumento de palabra clave " "*fromfile_prefix_chars* para el constructor :class:`ArgumentParser`) se leen " "uno por línea. :meth:`convert_arg_line_to_args` puede ser invalidado para " "una lectura más elegante." #: ../Doc/library/argparse.rst:2142 msgid "" "This method takes a single argument *arg_line* which is a string read from " "the argument file. It returns a list of arguments parsed from this string. " "The method is called once per line read from the argument file, in order." msgstr "" "Este método utiliza un sólo argumento *arg_line* que es una cadena de " "caracteres leída desde el archivo de argumentos. Retorna una lista de " "argumentos analizados a partir de esta cadena de caracteres. El método se " "llama una vez por línea leída del fichero de argumentos, en orden." #: ../Doc/library/argparse.rst:2146 msgid "" "A useful override of this method is one that treats each space-separated " "word as an argument. The following example demonstrates how to do this::" msgstr "" "Una alternativa útil de este método es la que trata cada palabra separada " "por un espacio como un argumento. El siguiente ejemplo demuestra cómo " "hacerlo::" #: ../Doc/library/argparse.rst:2155 msgid "Exiting methods" msgstr "Métodos de salida" #: ../Doc/library/argparse.rst:2159 msgid "" "This method terminates the program, exiting with the specified *status* and, " "if given, it prints a *message* before that. The user can override this " "method to handle these steps differently::" msgstr "" "Este método finaliza el programa, saliendo con el *status* especificado y, " "si corresponde, muestra un *message* antes de eso. El usuario puede anular " "este método para manejar estos pasos de manera diferente::" #: ../Doc/library/argparse.rst:2171 msgid "" "This method prints a usage message including the *message* to the standard " "error and terminates the program with a status code of 2." msgstr "" "Este método imprime un mensaje de uso incluyendo el *message* para error " "estándar y finaliza el programa con código de estado 2." #: ../Doc/library/argparse.rst:2176 msgid "Intermixed parsing" msgstr "Análisis entremezclado" #: ../Doc/library/argparse.rst:2181 msgid "" "A number of Unix commands allow the user to intermix optional arguments with " "positional arguments. The :meth:`~ArgumentParser.parse_intermixed_args` " "and :meth:`~ArgumentParser.parse_known_intermixed_args` methods support this " "parsing style." msgstr "" "Una serie de comandos *Unix* permiten al usuario mezclar argumentos " "opcionales con argumentos de posición. Los métodos :meth:`~ArgumentParser." "parse_intermixed_args` y :meth:`~ArgumentParser.parse_known_intermixed_args` " "soportan este modo de análisis." #: ../Doc/library/argparse.rst:2186 msgid "" "These parsers do not support all the argparse features, and will raise " "exceptions if unsupported features are used. In particular, subparsers, " "``argparse.REMAINDER``, and mutually exclusive groups that include both " "optionals and positionals are not supported." msgstr "" "Estos analizadores no soportan todas las capacidades de *argparse*, y " "generarán excepciones si se utilizan capacidades no soportadas. En " "particular, los analizadores secundarios, ``argparse.REMAINDER``, y los " "grupos mutuamente exclusivos que incluyen tanto opcionales como de posición " "no están soportados." #: ../Doc/library/argparse.rst:2191 msgid "" "The following example shows the difference between :meth:`~ArgumentParser." "parse_known_args` and :meth:`~ArgumentParser.parse_intermixed_args`: the " "former returns ``['2', '3']`` as unparsed arguments, while the latter " "collects all the positionals into ``rest``. ::" msgstr "" "El siguiente ejemplo muestra la diferencia entre :meth:`~ArgumentParser." "parse_known_args` y :meth:`~ArgumentParser.parse_intermixed_args`: el " "primero retorna ``['2', '3']`` como argumentos sin procesar, mientras que el " "segundo recoge todos los de posición en ``rest``. ::" #: ../Doc/library/argparse.rst:2206 msgid "" ":meth:`~ArgumentParser.parse_known_intermixed_args` returns a two item tuple " "containing the populated namespace and the list of remaining argument " "strings. :meth:`~ArgumentParser.parse_intermixed_args` raises an error if " "there are any remaining unparsed argument strings." msgstr "" ":meth:`~ArgumentParser.parse_known_intermixed_args` retorna una tupla de dos " "elementos que contiene el espacio de nombres poblado y la lista de los " "restantes argumentos de cadenas de caracteres. :meth:`~ArgumentParser." "parse_intermixed_args` arroja un error si quedan argumentos de cadenas de " "caracteres sin procesar." #: ../Doc/library/argparse.rst:2216 msgid "Upgrading optparse code" msgstr "Actualizar el código de *optparse*" #: ../Doc/library/argparse.rst:2218 msgid "" "Originally, the :mod:`argparse` module had attempted to maintain " "compatibility with :mod:`optparse`. However, :mod:`optparse` was difficult " "to extend transparently, particularly with the changes required to support " "the new ``nargs=`` specifiers and better usage messages. When most " "everything in :mod:`optparse` had either been copy-pasted over or monkey-" "patched, it no longer seemed practical to try to maintain the backwards " "compatibility." msgstr "" "Originalmente, el módulo :mod:`argparse` había intentado mantener la " "compatibilidad con :mod:`optparse`. Sin embargo, :mod:`optparse` era difícil " "de extender de forma transparente, particularmente con los cambios " "necesarios para soportar los nuevos especificadores ``nargs=`` y los " "mensajes de uso mejorados. Cuando casi todo en :mod:`optparse` había sido " "copiado y pegado o *monkey-patched*, ya no parecía práctico tratar de " "mantener la retro-compatibilidad." #: ../Doc/library/argparse.rst:2225 msgid "" "The :mod:`argparse` module improves on the standard library :mod:`optparse` " "module in a number of ways including:" msgstr "" "El módulo :mod:`argparse` mejora la biblioteca estándar del módulo :mod:" "`optparse` de varias maneras, incluyendo:" #: ../Doc/library/argparse.rst:2228 msgid "Handling positional arguments." msgstr "Manejando argumentos de posición." #: ../Doc/library/argparse.rst:2229 msgid "Supporting sub-commands." msgstr "Soportando sub-comandos." #: ../Doc/library/argparse.rst:2230 msgid "Allowing alternative option prefixes like ``+`` and ``/``." msgstr "Permitiendo prefijos de opción alternativos como ``+`` y ``/``." #: ../Doc/library/argparse.rst:2231 msgid "Handling zero-or-more and one-or-more style arguments." msgstr "Manejando argumentos de estilo cero o más y uno o más." #: ../Doc/library/argparse.rst:2232 msgid "Producing more informative usage messages." msgstr "Generando mensajes de uso más informativos." #: ../Doc/library/argparse.rst:2233 msgid "Providing a much simpler interface for custom ``type`` and ``action``." msgstr "" "Proporcionando una interfaz mucho más simple para ``type`` y ``action`` " "personalizadas." #: ../Doc/library/argparse.rst:2235 msgid "A partial upgrade path from :mod:`optparse` to :mod:`argparse`:" msgstr "" "Una manera de actualizar parcialmente de :mod:`optparse` a :mod:`argparse`:" #: ../Doc/library/argparse.rst:2237 msgid "" "Replace all :meth:`optparse.OptionParser.add_option` calls with :meth:" "`ArgumentParser.add_argument` calls." msgstr "" "Reemplaza todas las llamadas :meth:`optparse.OptionParser.add_option` con " "llamadas :meth:`ArgumentParser.add_argument`." #: ../Doc/library/argparse.rst:2240 msgid "" "Replace ``(options, args) = parser.parse_args()`` with ``args = parser." "parse_args()`` and add additional :meth:`ArgumentParser.add_argument` calls " "for the positional arguments. Keep in mind that what was previously called " "``options``, now in the :mod:`argparse` context is called ``args``." msgstr "" "Reemplaza ``(options, args) = parser.parse_args()`` con ``args = parser." "parse_args()`` y agrega las llamadas adicionales :meth:`ArgumentParser." "add_argument` para los argumentos de posición. Ten en cuenta que lo que " "antes se llamaba ``options``, ahora en el contexto :mod:`argparse` se llama " "``args``." #: ../Doc/library/argparse.rst:2245 msgid "" "Replace :meth:`optparse.OptionParser.disable_interspersed_args` by using :" "meth:`~ArgumentParser.parse_intermixed_args` instead of :meth:" "`~ArgumentParser.parse_args`." msgstr "" "Reemplaza :meth:`optparse.OptionParser.disable_interspersed_args` por :meth:" "`~ArgumentParser.parse_intermixed_args` en lugar de :meth:`~ArgumentParser." "parse_args`." #: ../Doc/library/argparse.rst:2249 msgid "" "Replace callback actions and the ``callback_*`` keyword arguments with " "``type`` or ``action`` arguments." msgstr "" "Reemplaza las acciones de respuesta y los argumentos de palabra clave " "``callback_*`` con argumentos de ``type`` o ``action``." #: ../Doc/library/argparse.rst:2252 msgid "" "Replace string names for ``type`` keyword arguments with the corresponding " "type objects (e.g. int, float, complex, etc)." msgstr "" "Reemplaza los nombres de cadena de caracteres por argumentos de palabra " "clave ``type`` con los correspondientes objetos tipo (por ejemplo, *int*, " "*float*, *complex*, etc)." #: ../Doc/library/argparse.rst:2255 msgid "" "Replace :class:`optparse.Values` with :class:`Namespace` and :exc:`optparse." "OptionError` and :exc:`optparse.OptionValueError` with :exc:`ArgumentError`." msgstr "" "Reemplaza :class:`optparse.Values` por :class:`Namespace` y :exc:`optparse." "OptionError` y :exc:`optparse.OptionValueError` por :exc:`ArgumentError`." #: ../Doc/library/argparse.rst:2259 #, python-format msgid "" "Replace strings with implicit arguments such as ``%default`` or ``%prog`` " "with the standard Python syntax to use dictionaries to format strings, that " "is, ``%(default)s`` and ``%(prog)s``." msgstr "" "Reemplaza las cadenas de caracteres con argumentos implícitos como " "``%default`` o ``%prog`` por la sintaxis estándar de Python y usa " "diccionarios para dar formato a cadenas de caracteres, es decir, " "``%(default)s`` y ``%(prog)s``." #: ../Doc/library/argparse.rst:2263 msgid "" "Replace the OptionParser constructor ``version`` argument with a call to " "``parser.add_argument('--version', action='version', version='')``." msgstr "" "Reemplaza el argumento ``version`` del constructor *OptionParser* por una " "llamada a ``parser.add_argument('--version', action='version', version='')``." #~ msgid "" #~ "``'append_const'`` - This stores a list, and appends the value specified " #~ "by the const_ keyword argument to the list. (Note that the const_ " #~ "keyword argument defaults to ``None``.) The ``'append_const'`` action is " #~ "typically useful when multiple arguments need to store constants to the " #~ "same list. For example::" #~ msgstr "" #~ "``'append_const'`` - Esta almacena una lista, y añade el valor " #~ "especificado por el argumento de palabra clave const_ a la lista. (Nótese " #~ "que el argumento de palabra clave const_ por defecto es ``None``.) La " #~ "acción ``'append_const'`` es útil típicamente cuando múltiples argumentos " #~ "necesitan almacenar constantes a la misma lista. Por ejemplo::" #~ msgid "" #~ "With the ``'store_const'`` and ``'append_const'`` actions, the ``const`` " #~ "keyword argument must be given. For other actions, it defaults to " #~ "``None``." #~ msgstr "" #~ "Con las acciones ``'store_const'`` y ``'append_const'``, se debe asignar " #~ "el argumento palabra clave ``const``. Para otras acciones, por defecto es " #~ "``None``."