@@ -2061,6 +2061,7 @@ msgid ""
2061
2061
"At this point, the original ``-n``/``--dry-run`` option is no longer "
2062
2062
"accessible, so :mod:`optparse` removes it, leaving this help text::"
2063
2063
msgstr ""
2064
+ "这时,原有的 ``-n``/``--dry-run`` 选项将不再可用,因此 :mod:`optparse` 会将其移除,帮助文本将变成这样::"
2064
2065
2065
2066
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/library/optparse.rst:1483
2066
2067
msgid "Cleanup"
@@ -2075,14 +2076,17 @@ msgid ""
2075
2076
" long-running applications where large object graphs are reachable from your"
2076
2077
" OptionParser."
2077
2078
msgstr ""
2079
+ "OptionParser 实例存在一些循环引用。 这对 Python 的垃圾回收器来说应该不是问题,但你可能希望在你完成对 OptionParser "
2080
+ "的使用后通过调用其 :meth:`~OptionParser.destroy` 来显式地中断循环引用。 这在可以从你的 OptionParser "
2081
+ "访问大型对象图的长期运行应用程序中特别有用。"
2078
2082
2079
2083
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/library/optparse.rst:1496
2080
2084
msgid "Other methods"
2081
- msgstr ""
2085
+ msgstr "其他方法 "
2082
2086
2083
2087
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/library/optparse.rst:1498
2084
2088
msgid "OptionParser supports several other public methods:"
2085
- msgstr ""
2089
+ msgstr "OptionParser 还支持其他一些公有方法: "
2086
2090
2087
2091
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/library/optparse.rst:1502
2088
2092
msgid ""
@@ -2091,6 +2095,8 @@ msgid ""
2091
2095
"usage string; use :data:`optparse.SUPPRESS_USAGE` to suppress a usage "
2092
2096
"message."
2093
2097
msgstr ""
2098
+ "根据上述的规则为 ``usage`` 构造器关键字参数设置用法字符串。 传入 ``None`` 将设置默认的用法字符串;使用 "
2099
+ ":data:`optparse.SUPPRESS_USAGE` 将屏蔽用法消息。"
2094
2100
2095
2101
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/library/optparse.rst:1508
2096
2102
msgid ""
@@ -2099,12 +2105,14 @@ msgid ""
2099
2105
"is replaced with the name of the current program. Does nothing if "
2100
2106
"``self.usage`` is empty or not defined."
2101
2107
msgstr ""
2108
+ "将当前程序的用法消息 (``self.usage``) 打印到 *file* (默认为 stdout)。 出现在 ``self.usage`` "
2109
+ "中的字符串 ``%prog`` 将全部被替换为当前程序的名称。 如果 ``self.usage`` 为空或未定义则不做任何事情。"
2102
2110
2103
2111
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/library/optparse.rst:1515
2104
2112
msgid ""
2105
2113
"Same as :meth:`print_usage` but returns the usage string instead of printing"
2106
2114
" it."
2107
- msgstr ""
2115
+ msgstr "与 :meth:`print_usage` 类似但是将返回用法字符串而不是打印它。 "
2108
2116
2109
2117
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/library/optparse.rst:1520
2110
2118
msgid ""
@@ -2114,14 +2122,16 @@ msgid ""
2114
2122
"several\" mode\" options all set the same destination, any one of them can "
2115
2123
"set the default, and the last one wins::"
2116
2124
msgstr ""
2125
+ "一次性地为多个选项目标设置默认值。 使用 :meth:`set_defaults` 是为选项设置默认值的推荐方式同,因为多个选项可以共享同一个目标。 "
2126
+ "举例来说,如果几个\" mode\" 选项全部设置了相同的目标,则它们中的任何一个都可以设置默认值,而最终生效的将是最后一次设置的默认值::"
2117
2127
2118
2128
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/library/optparse.rst:1533
2119
2129
msgid "To avoid this confusion, use :meth:`set_defaults`::"
2120
- msgstr ""
2130
+ msgstr "为避免混淆,请使用 :meth:`set_defaults`:: "
2121
2131
2122
2132
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/library/optparse.rst:1545
2123
2133
msgid "Option Callbacks"
2124
- msgstr ""
2134
+ msgstr "选项回调 "
2125
2135
2126
2136
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/library/optparse.rst:1547
2127
2137
msgid ""
@@ -2130,24 +2140,26 @@ msgid ""
2130
2140
"callback option. Extending :mod:`optparse` is more general, but overkill for"
2131
2141
" a lot of simple cases. Quite often a simple callback is all you need."
2132
2142
msgstr ""
2143
+ "当 :mod:`optparse` 的内置动作和类型不能满足你的需要时,你有两个选择:扩展 :mod:`optparse` 或定义一个 callback"
2144
+ " 选项。 扩展 :mod:`optparse` 的方式更为通用,但对许多简单场景来说是大材小用了。 你所需要的往往只是一个简单的回调。"
2133
2145
2134
2146
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/library/optparse.rst:1552
2135
2147
msgid "There are two steps to defining a callback option:"
2136
- msgstr ""
2148
+ msgstr "定义一个回调选项分为两步: "
2137
2149
2138
2150
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/library/optparse.rst:1554
2139
2151
msgid "define the option itself using the ``\" callback\" `` action"
2140
- msgstr ""
2152
+ msgstr "使用 `` \" callback \" `` 动作定义选项本身 "
2141
2153
2142
2154
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/library/optparse.rst:1556
2143
2155
msgid ""
2144
2156
"write the callback; this is a function (or method) that takes at least four "
2145
2157
"arguments, as described below"
2146
- msgstr ""
2158
+ msgstr "编写回调;它是一个接受至少四个参数的函数(或方法),如下所述 "
2147
2159
2148
2160
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/library/optparse.rst:1563
2149
2161
msgid "Defining a callback option"
2150
- msgstr ""
2162
+ msgstr "定义回调选项 "
2151
2163
2152
2164
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/library/optparse.rst:1565
2153
2165
msgid ""