@@ -1467,6 +1467,8 @@ msgid ""
14671467" help text is supplied, the option will be listed without help text. To "
14681468"hide this option, use the special value :data:`optparse.SUPPRESS_HELP`."
14691469msgstr ""
1470+ "当用户提供 :attr:`~Option.help` 选项 (例如 ``--help``) 之后将在列出所有可用选项时针对此选项打印的帮助文本。 "
1471+ "如果没有提供帮助文本,则列出选项时将不附带帮助文本。 要隐藏此选项,请使用特殊值 :data:`optparse.SUPPRESS_HELP`。"
14701472
14711473#: ../../library/optparse.rst:1069
14721474msgid ""
@@ -1703,6 +1705,8 @@ msgid ""
17031705"be listed in the help message. To omit an option entirely, use the special "
17041706"value :data:`optparse.SUPPRESS_HELP`."
17051707msgstr ""
1708+ "如果没有为某个选项提供 :attr:`~Option.help` 字符串,它仍将在帮助消息中列出。 要完全略去某个选项,请使用特殊值 "
1709+ ":data:`optparse.SUPPRESS_HELP`。"
17061710
17071711#: ../../library/optparse.rst:1237
17081712msgid ""
@@ -1822,7 +1826,7 @@ msgstr "解析参数"
18221826msgid ""
18231827"The whole point of creating and populating an OptionParser is to call its "
18241828":meth:`parse_args` method::"
1825- msgstr ""
1829+ msgstr "创建和填充 OptionParser 的基本目的是调用其 :meth:`parse_args` 方法:: "
18261830
18271831#: ../../library/optparse.rst:1328
18281832msgid "where the input parameters are"
@@ -1847,10 +1851,12 @@ msgid ""
18471851"new instance of :class:`Values`) -- if you give an existing object, the "
18481852"option defaults will not be initialized on it"
18491853msgstr ""
1854+ "要用于存储选项参数的 :class:`optparse.Values` 对象 (默认:一个新的 :class:`Values` 实例) -- "
1855+ "如果你给出一个现有对象,则不会基于它来初始化选项的默认值"
18501856
18511857#: ../../library/optparse.rst:1338
18521858msgid "and the return values are"
1853- msgstr ""
1859+ msgstr "返回值为 "
18541860
18551861#: ../../library/optparse.rst:1342
18561862msgid "``options``"
@@ -1860,7 +1866,7 @@ msgstr "``options``"
18601866msgid ""
18611867"the same object that was passed in as ``values``, or the optparse.Values "
18621868"instance created by :mod:`optparse`"
1863- msgstr ""
1869+ msgstr "同一个对象将作为 ``values``,或 :mod:`optparse` 所创建的 optparse.Values 实例传入 "
18641870
18651871#: ../../library/optparse.rst:1345
18661872msgid ""
@@ -1874,6 +1880,8 @@ msgid ""
18741880" one for every option argument stored to an option destination) and returned"
18751881" by :meth:`parse_args`."
18761882msgstr ""
1883+ "最常见的用法是不提供任何关键字参数。 如果你提供了 ``values``,它将通过重复的 :func:`setattr` "
1884+ "调用来修改(大致为每个存储到指定选项目标的选项参数调用一次)并由 :meth:`parse_args` 返回。"
18771885
18781886#: ../../library/optparse.rst:1352
18791887msgid ""
@@ -1882,6 +1890,8 @@ msgid ""
18821890"message. This ultimately terminates your process with an exit status of 2 "
18831891"(the traditional Unix exit status for command-line errors)."
18841892msgstr ""
1893+ "如果 :meth:`parse_args` 在参数列表中遇到任何错误,它将调用 OptionParser 的 :meth:`error` "
1894+ "方法并附带适当的最终用户错误消息。 这会完全终结你的进程并将退出状态设为 2 (传统的针对命令行错误的 Unix 退出状态)。"
18851895
18861896#: ../../library/optparse.rst:1361
18871897msgid "Querying and manipulating your option parser"
@@ -2077,6 +2087,8 @@ msgid ""
20772087"usage string; use :data:`optparse.SUPPRESS_USAGE` to suppress a usage "
20782088"message."
20792089msgstr ""
2090+ "根据上述的规则为 ``usage`` 构造器关键字参数设置用法字符串。 传入 ``None`` 将设置默认的用法字符串;使用 "
2091+ ":data:`optparse.SUPPRESS_USAGE` 将屏蔽用法消息。"
20802092
20812093#: ../../library/optparse.rst:1508
20822094msgid ""
@@ -2303,6 +2315,8 @@ msgid ""
23032315"``parser.largs``, e.g. by adding more arguments to it. (This list will "
23042316"become ``args``, the second return value of :meth:`parse_args`.)"
23052317msgstr ""
2318+ "当前的剩余参数列表,即已被读取但不属于选项或选项参数的参数。 可以任意修改 ``parser.largs``,例如向其添加更多的参数。 (该列表将成为 "
2319+ "``args``,即 :meth:`parse_args` 的第二个返回值。)"
23062320
23072321#: ../../library/optparse.rst:1653
23082322msgid "``parser.rargs``"
@@ -2776,3 +2790,8 @@ msgid ""
27762790"destinations in question; they can just leave the default as ``None`` and "
27772791":meth:`ensure_value` will take care of getting it right when it's needed."
27782792msgstr ""
2793+ "如果 ``values`` 的 ``attr`` 属性不存在或为 ``None``,则 ensure_value() 会先将其设为 "
2794+ "``value``,然后返回该值。 这非常适用于 ``\" extend\" ``, ``\" append\" `` 和 ``\" count\" `` "
2795+ "等动作,它们会将数据累积在一个变量中并预期该变量属于特定的类型(前两项是一个列表,后一项是一个整数)。 使用 :meth:`ensure_value` "
2796+ "意味着使用你的动作的脚本无需关心为相应的选项目标设置默认值;可以简单地保持默认的 ``None`` 则 :meth:`ensure_value` "
2797+ "将在必要时负责为其设置适当的值。"