@@ -1228,6 +1228,8 @@ msgid ""
12281228" which processes arguments from the command-line. Any object which follows "
12291229"this API may be passed as the ``action`` parameter to :meth:`add_argument`."
12301230msgstr ""
1231+ "Action 类实现了 Action API,它是一个返回可调用对象的可调用对象,返回的可调用对象可处理来自命令行的参数。 任何遵循此 API "
1232+ "的对象均可作为 ``action`` 形参传给 :meth:`add_argument`。"
12311233
12321234#: ../../library/argparse.rst:1309
12331235msgid ""
@@ -1237,6 +1239,9 @@ msgid ""
12371239"keyword arguments passed to :meth:`ArgumentParser.add_argument` except for "
12381240"the ``action`` itself."
12391241msgstr ""
1242+ "Action 对象会被 ArgumentParser 用来表示解析从命令行中的一个或多个字符串中解析出单个参数所必须的信息。 Action "
1243+ "类必须接受两个位置参数以及传给 :meth:`ArgumentParser.add_argument` 的任何关键字参数,除了 ``action`` "
1244+ "本身。"
12401245
12411246#: ../../library/argparse.rst:1315
12421247msgid ""
@@ -1245,43 +1250,53 @@ msgid ""
12451250" \" type\" , \" required\" , \" help\" , etc. defined. The easiest way to ensure "
12461251"these attributes are defined is to call ``Action.__init__``."
12471252msgstr ""
1253+ "Action 的实例(或作为or return value of any callable to the ``action`` "
1254+ "形参的任何可调用对象的返回值)应当定义 \" dest\" , \" option_strings\" , \" default\" , \" type\" , "
1255+ "\" required\" , \" help\" 等属性。 确保这些属性被定义的最容易方式是调用 ``Action.__init__``。"
12481256
12491257#: ../../library/argparse.rst:1320
12501258msgid ""
12511259"Action instances should be callable, so subclasses must override the "
12521260"``__call__`` method, which should accept four parameters:"
1253- msgstr ""
1261+ msgstr "Action 的实例应当为可调用对象,因此所有子类都必须重载 ``__call__`` 方法,该方法应当接受四个形参: "
12541262
12551263#: ../../library/argparse.rst:1323
12561264msgid "``parser`` - The ArgumentParser object which contains this action."
1257- msgstr ""
1265+ msgstr "``parser`` - 包含此动作的 ArgumentParser 对象。 "
12581266
12591267#: ../../library/argparse.rst:1325
12601268msgid ""
12611269"``namespace`` - The :class:`Namespace` object that will be returned by "
12621270":meth:`~ArgumentParser.parse_args`. Most actions add an attribute to this "
12631271"object using :func:`setattr`."
12641272msgstr ""
1273+ "``namespace`` - 将由 :meth:`~ArgumentParser.parse_args` 返回的 :class:`Namespace`"
1274+ " 对象。 大多数动作会使用 :func:`setattr` 为此对象添加属性。"
12651275
12661276#: ../../library/argparse.rst:1329
12671277msgid ""
12681278"``values`` - The associated command-line arguments, with any type "
12691279"conversions applied. Type conversions are specified with the type_ keyword "
12701280"argument to :meth:`~ArgumentParser.add_argument`."
12711281msgstr ""
1282+ "``values`` - 已关联的命令行参数,并提供相应的类型转换。 类型转换由 "
1283+ ":meth:`~ArgumentParser.add_argument` 的 type_ 关键字参数来指定。"
12721284
12731285#: ../../library/argparse.rst:1333
12741286msgid ""
12751287"``option_string`` - The option string that was used to invoke this action. "
12761288"The ``option_string`` argument is optional, and will be absent if the action"
12771289" is associated with a positional argument."
12781290msgstr ""
1291+ "``option_string`` - 被用来发起调用此动作的选项字符串。 ``option_string`` "
1292+ "参数是可选的,且此参数在动作关联到位置参数时将被略去。"
12791293
12801294#: ../../library/argparse.rst:1337
12811295msgid ""
12821296"The ``__call__`` method may perform arbitrary actions, but will typically "
12831297"set attributes on the ``namespace`` based on ``dest`` and ``values``."
12841298msgstr ""
1299+ "``__call__`` 方法可以执行任意动作,但通常将基于 ``dest`` 和 ``values`` 来设置 ``namespace`` 的属性。"
12851300
12861301#: ../../library/argparse.rst:1342
12871302msgid "The parse_args() method"
@@ -1291,7 +1306,7 @@ msgstr "parse_args() 方法"
12911306msgid ""
12921307"Convert argument strings to objects and assign them as attributes of the "
12931308"namespace. Return the populated namespace."
1294- msgstr ""
1309+ msgstr "将参数字符串转换为对象并将其设为命名空间的属性。 返回带有成员的命名空间。 "
12951310
12961311#: ../../library/argparse.rst:1349
12971312msgid ""
0 commit comments