@@ -11,7 +11,7 @@ msgid ""
11
11
msgstr ""
12
12
"Project-Id-Version : Python 3.13\n "
13
13
"Report-Msgid-Bugs-To : \n "
14
- "POT-Creation-Date : 2024-12-13 14:18 +0000\n "
14
+ "POT-Creation-Date : 2024-12-27 14:16 +0000\n "
15
15
"PO-Revision-Date : 2021-06-28 01:06+0000\n "
16
16
"Last-Translator : tomo, 2021\n "
17
17
"Language-Team : Japanese (https://app.transifex.com/python-doc/teams/5390/ "
@@ -30,22 +30,16 @@ msgstr ""
30
30
msgid "**Source code:** :source:`Lib/getopt.py`"
31
31
msgstr "**ソースコード:** :source:`Lib/getopt.py`"
32
32
33
- #: ../../library/getopt.rst:10
33
+ #: ../../library/getopt.rst:12
34
34
msgid ""
35
- "The :mod:`getopt` module is :term:`soft deprecated` and will not be "
36
- "developed further; development will continue with the :mod:`argparse` module."
35
+ "This module is considered feature complete. A more declarative and "
36
+ "extensible alternative to this API is provided in the :mod:`optparse` "
37
+ "module. Further functional enhancements for command line parameter "
38
+ "processing are provided either as third party modules on PyPI, or else as "
39
+ "features in the :mod:`argparse` module."
37
40
msgstr ""
38
41
39
- #: ../../library/getopt.rst:17
40
- msgid ""
41
- "The :mod:`getopt` module is a parser for command line options whose API is "
42
- "designed to be familiar to users of the C :c:func:`!getopt` function. Users "
43
- "who are unfamiliar with the C :c:func:`!getopt` function or who would like "
44
- "to write less code and get better help and error messages should consider "
45
- "using the :mod:`argparse` module instead."
46
- msgstr ""
47
-
48
- #: ../../library/getopt.rst:25
42
+ #: ../../library/getopt.rst:20
49
43
msgid ""
50
44
"This module helps scripts to parse the command line arguments in ``sys."
51
45
"argv``. It supports the same conventions as the Unix :c:func:`!getopt` "
@@ -54,11 +48,21 @@ msgid ""
54
48
"be used as well via an optional third argument."
55
49
msgstr ""
56
50
57
- #: ../../library/getopt.rst:31
51
+ #: ../../library/getopt.rst:26
52
+ msgid ""
53
+ "Users who are unfamiliar with the Unix :c:func:`!getopt` function should "
54
+ "consider using the :mod:`argparse` module instead. Users who are familiar "
55
+ "with the Unix :c:func:`!getopt` function, but would like to get equivalent "
56
+ "behavior while writing less code and getting better help and error messages "
57
+ "should consider using the :mod:`optparse` module. See :ref:`choosing-an-"
58
+ "argument-parser` for additional details."
59
+ msgstr ""
60
+
61
+ #: ../../library/getopt.rst:33
58
62
msgid "This module provides two functions and an exception:"
59
63
msgstr "このモジュールは2つの関数と1つの例外を提供しています:"
60
64
61
- #: ../../library/getopt.rst:37
65
+ #: ../../library/getopt.rst:39
62
66
msgid ""
63
67
"Parses command line options and parameter list. *args* is the argument list "
64
68
"to be parsed, without the leading reference to the running program. "
@@ -68,14 +72,14 @@ msgid ""
68
72
"func:`!getopt` uses)."
69
73
msgstr ""
70
74
71
- #: ../../library/getopt.rst:45
75
+ #: ../../library/getopt.rst:47
72
76
msgid ""
73
77
"Unlike GNU :c:func:`!getopt`, after a non-option argument, all further "
74
78
"arguments are considered also non-options. This is similar to the way non-"
75
79
"GNU Unix systems work."
76
80
msgstr ""
77
81
78
- #: ../../library/getopt.rst:49
82
+ #: ../../library/getopt.rst:51
79
83
msgid ""
80
84
"*longopts*, if specified, must be a list of strings with the names of the "
81
85
"long options which should be supported. The leading ``'--'`` characters "
@@ -97,7 +101,7 @@ msgstr ""
97
101
"foo`` にマッチしますが、``--f`` では一意に決定できないので、:exc:"
98
102
"`GetoptError` が送出されます。"
99
103
100
- #: ../../library/getopt.rst:60
104
+ #: ../../library/getopt.rst:62
101
105
msgid ""
102
106
"The return value consists of two elements: the first is a list of ``(option, "
103
107
"value)`` pairs; the second is the list of program arguments left after the "
@@ -118,7 +122,7 @@ msgstr ""
118
122
"順に並んでいて、複数回同じオプションを指定できます。長形式と短形式のオプショ"
119
123
"ンは混在できます。"
120
124
121
- #: ../../library/getopt.rst:73
125
+ #: ../../library/getopt.rst:75
122
126
msgid ""
123
127
"This function works like :func:`getopt`, except that GNU style scanning mode "
124
128
"is used by default. This means that option and non-option arguments may be "
@@ -130,14 +134,14 @@ msgstr ""
130
134
"混在させることができます。:func:`getopt` 関数はオプションでない引数を見つける"
131
135
"と解析を停止します。"
132
136
133
- #: ../../library/getopt.rst:78
137
+ #: ../../library/getopt.rst:80
134
138
msgid ""
135
139
"If the first character of the option string is ``'+'``, or if the "
136
140
"environment variable :envvar:`!POSIXLY_CORRECT` is set, then option "
137
141
"processing stops as soon as a non-option argument is encountered."
138
142
msgstr ""
139
143
140
- #: ../../library/getopt.rst:85
144
+ #: ../../library/getopt.rst:87
141
145
msgid ""
142
146
"This is raised when an unrecognized option is found in the argument list or "
143
147
"when an option requiring an argument is given none. The argument to the "
@@ -148,16 +152,16 @@ msgid ""
148
152
"which the exception relates, :attr:`!opt` is an empty string."
149
153
msgstr ""
150
154
151
- #: ../../library/getopt.rst:96
155
+ #: ../../library/getopt.rst:98
152
156
msgid "Alias for :exc:`GetoptError`; for backward compatibility."
153
157
msgstr ""
154
158
":exc:`GetoptError` へのエイリアスです。後方互換性のために残されています。"
155
159
156
- #: ../../library/getopt.rst:98
160
+ #: ../../library/getopt.rst:100
157
161
msgid "An example using only Unix style options:"
158
162
msgstr "Unix スタイルのオプションを使った例です:"
159
163
160
- #: ../../library/getopt.rst:100
164
+ #: ../../library/getopt.rst:102
161
165
msgid ""
162
166
">>> import getopt\n"
163
167
">>> args = '-a -b -cfoo -d bar a1 a2'.split()\n"
@@ -170,11 +174,11 @@ msgid ""
170
174
"['a1', 'a2']"
171
175
msgstr ""
172
176
173
- #: ../../library/getopt.rst:112
177
+ #: ../../library/getopt.rst:114
174
178
msgid "Using long option names is equally easy:"
175
179
msgstr "長形式のオプションを使っても同様です:"
176
180
177
- #: ../../library/getopt.rst:114
181
+ #: ../../library/getopt.rst:116
178
182
msgid ""
179
183
">>> s = '--condition=foo --testing --output-file abc.def -x a1 a2'\n"
180
184
">>> args = s.split()\n"
@@ -190,11 +194,11 @@ msgid ""
190
194
"['a1', 'a2']"
191
195
msgstr ""
192
196
193
- #: ../../library/getopt.rst:127
197
+ #: ../../library/getopt.rst:129
194
198
msgid "In a script, typical usage is something like this:"
195
199
msgstr ""
196
200
197
- #: ../../library/getopt.rst:129
201
+ #: ../../library/getopt.rst:131
198
202
msgid ""
199
203
"import getopt, sys\n"
200
204
"\n"
@@ -220,36 +224,69 @@ msgid ""
220
224
" output = a\n"
221
225
" else:\n"
222
226
" assert False, \" unhandled option\" \n"
223
- " # ... \n"
227
+ " process(args, output=output, verbose=verbose) \n"
224
228
"\n"
225
229
"if __name__ == \" __main__\" :\n"
226
230
" main()"
227
231
msgstr ""
228
232
229
- #: ../../library/getopt.rst:158
233
+ #: ../../library/getopt.rst:160
230
234
msgid ""
231
235
"Note that an equivalent command line interface could be produced with less "
232
236
"code and more informative help and error messages by using the :mod:"
233
- "`argparse` module:"
237
+ "`optparse` module:"
238
+ msgstr ""
239
+
240
+ #: ../../library/getopt.rst:163
241
+ msgid ""
242
+ "import optparse\n"
243
+ "\n"
244
+ "if __name__ == '__main__':\n"
245
+ " parser = optparse.OptionParser()\n"
246
+ " parser.add_option('-o', '--output')\n"
247
+ " parser.add_option('-v', dest='verbose', action='store_true')\n"
248
+ " opts, args = parser.parse_args()\n"
249
+ " process(args, output=opts.output, verbose=opts.verbose)"
234
250
msgstr ""
235
251
236
- #: ../../library/getopt.rst:161
252
+ #: ../../library/getopt.rst:174
253
+ msgid ""
254
+ "A roughly equivalent command line interface for this case can also be "
255
+ "produced by using the :mod:`argparse` module:"
256
+ msgstr ""
257
+
258
+ #: ../../library/getopt.rst:177
237
259
msgid ""
238
260
"import argparse\n"
239
261
"\n"
240
262
"if __name__ == '__main__':\n"
241
263
" parser = argparse.ArgumentParser()\n"
242
264
" parser.add_argument('-o', '--output')\n"
243
265
" parser.add_argument('-v', dest='verbose', action='store_true')\n"
266
+ " parser.add_argument('rest', nargs='*')\n"
244
267
" args = parser.parse_args()\n"
245
- " # ... do something with args.output ...\n"
246
- " # ... do something with args.verbose .."
268
+ " process(args.rest, output=args.output, verbose=args.verbose)"
247
269
msgstr ""
248
270
249
- #: ../../library/getopt.rst:175
271
+ #: ../../library/getopt.rst:189
272
+ msgid ""
273
+ "See :ref:`choosing-an-argument-parser` for details on how the ``argparse`` "
274
+ "version of this code differs in behaviour from the ``optparse`` (and "
275
+ "``getopt``) version."
276
+ msgstr ""
277
+
278
+ #: ../../library/getopt.rst:195
279
+ msgid "Module :mod:`optparse`"
280
+ msgstr ""
281
+
282
+ #: ../../library/getopt.rst:196
283
+ msgid "Declarative command line option parsing."
284
+ msgstr ""
285
+
286
+ #: ../../library/getopt.rst:198
250
287
msgid "Module :mod:`argparse`"
251
288
msgstr ":mod:`argparse` モジュール"
252
289
253
- #: ../../library/getopt.rst:176
254
- msgid "Alternative command line option and argument parsing library."
255
- msgstr "別のコマンドラインオプションと引数の解析ライブラリ。 "
290
+ #: ../../library/getopt.rst:199
291
+ msgid "More opinionated command line option and argument parsing library."
292
+ msgstr ""
0 commit comments