GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — python-docs-ja/library/argparse.po at 3.14 · python/python-docs-ja Expand file tree/ Copy pathargparse.poMore file actions 4624 lines (4203 loc) · 196 KB / Copy pathargparse.poFile metadata and controls4624 lines (4203 loc) · 196 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 # SOME DESCRIPTIVE TITLE. # Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. # # Translators: # python-doc bot, 2025 # b785ccb154ea7c5e4722f287fb17d327_f3b4082, 2025 # Takanori Suzuki <[email protected]>, 2026 # #, fuzzy msgid "" msgstr "" "Project-Id-Version: Python 3.15\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2026-09-27 17:59+0000\n" "PO-Revision-Date: 2025-09-16 00:00+0000\n" "Last-Translator: Takanori Suzuki <[email protected]>, 2026\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" "Language: ja\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" #: ../../library/argparse.rst:2 msgid "" ":mod:`!argparse` --- Parser for command-line options, arguments and " "subcommands" msgstr "" ":mod:`!argparse` --- コマンドラインオプションや引数、サブコマンド向けのパー" "サー" #: ../../library/argparse.rst:9 msgid "**Source code:** :source:`Lib/argparse.py`" msgstr "**ソースコード:** :source:`Lib/argparse.py`" msgid "" "While :mod:`!argparse` is the default recommended standard library module " "for implementing basic command line applications, authors with more exacting " "requirements for exactly how their command line applications behave may find " "it doesn't provide the necessary level of control. Refer to :ref:`choosing-" "an-argument-parser` for alternatives to consider when ``argparse`` doesn't " "support behaviors that the application requires (such as entirely disabling " "support for interspersed options and positional arguments, or accepting " "option parameter values that start with ``-`` even when they correspond to " "another defined option)." msgstr "" ":mod:`!argparse` は基本的なコマンドラインアプリケーションの実装に推奨される標" "準ライブラリのモジュールですが、動作を厳密に制御したい場合には、必要な制御が" "できないことがあります。\n" "``argparse`` が必要な動作をサポートしていない場合、代替手段について" "は :ref:`choosing-an-argument-parser` を参照してください。\n" "例えば、オプションと位置引数の混在を完全に禁止したり、``-`` で始まる値が他の" "定義済みオプションと一致する場合でもオプションの値として受け付けたりしたい場" "合が該当します。" #: ../../library/argparse.rst-1 msgid "Tutorial" msgstr "チュートリアル" #: ../../library/argparse.rst:27 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 <argparse-tutorial>`." msgstr "" "このページは API のリファレンス情報が記載しています。:ref:`argparse チュート" "リアル <argparse-tutorial>` では、コマンドラインの解析についてより優しく説明" "しています。" 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 "" ":mod:`!argparse` モジュールを使うと、使いやすいコマンドラインインターフェース" "を簡単に作成できます。\n" "プログラムで必要な引数を定義すると、:mod:`!argparse` が :data:`sys.argv` から" "それらを解析する方法を判断します。\n" ":mod:`!argparse` はヘルプと使用法のメッセージも自動生成し、ユーザーが不正な引" "数を渡すとエラーを表示します。" 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 to the parser as " "whole::" msgstr "" ":mod:`!argparse` のコマンドラインインターフェースのサポート" "は、:class:`argparse.ArgumentParser` のインスタンスを中心に構成されていま" "す。\n" "このオブジェクトは引数の仕様を格納し、パーサー全体に適用するオプションを持ち" "ます。 ::" #: ../../library/argparse.rst:41 msgid "" "parser = argparse.ArgumentParser(\n" " prog='ProgramName',\n" " description='What the program does',\n" " epilog='Text at the bottom of help')" msgstr "" "parser = argparse.ArgumentParser(\n" " prog='ProgramName',\n" " description='What the program does',\n" " epilog='Text at the bottom of help')" #: ../../library/argparse.rst:46 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 "" ":meth:`ArgumentParser.add_argument` メソッドは各引数の仕様をパーサーに付属さ" "せます。このメソッドは位置引数、値を受け取るオプション、機能のオン/オフを切" "り替えるフラグをサポートします::" #: ../../library/argparse.rst:50 msgid "" "parser.add_argument('filename') # positional argument\n" "parser.add_argument('-c', '--count') # option that takes a value\n" "parser.add_argument('-v', '--verbose',\n" " action='store_true') # on/off flag" msgstr "" "parser.add_argument('filename') # 位置引数\n" "parser.add_argument('-c', '--count') # 値を取るオプション\n" "parser.add_argument('-v', '--verbose',\n" " action='store_true') # オン/オフフラグ" #: ../../library/argparse.rst:55 msgid "" "The :meth:`ArgumentParser.parse_args` method runs the parser and places the " "extracted data in a :class:`argparse.Namespace` object::" msgstr "" ":meth:`ArgumentParser.parse_args` メソッドはパーサーを実行し、抽出したデータ" "を :class:`argparse.Namespace` オブジェクト内に配置します::" msgid "" "args = parser.parse_args()\n" "print(args.filename, args.count, args.verbose)" msgstr "" "args = parser.parse_args()\n" "print(args.filename, args.count, args.verbose)" msgid "" "If you're looking for a guide about how to upgrade :mod:`optparse` code " "to :mod:`!argparse`, see :ref:`Upgrading Optparse Code <upgrading-optparse-" "code>`." msgstr "" ":mod:`optparse` のコードを :mod:`!argparse` に移行する方法は、:ref:`Optparse " "のコードのアップグレード <upgrading-optparse-code>` を参照してください。" #: ../../library/argparse.rst:66 msgid "ArgumentParser objects" msgstr "ArgumentParser オブジェクト" #: ../../library/argparse.rst:76 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 "" "新しい :class:`ArgumentParser` オブジェクトを生成します。すべての引数はキー" "ワード引数として渡すべきです。各引数についてはあとで詳しく説明しますが、簡単" "に言うと:" msgid "" "prog_ - The name of the program (default: generated from the ``__main__`` " "module attributes and ``sys.argv[0]``)" msgstr "" "prog_ - プログラム名 (デフォルト: ``__main__`` モジュールの属性と " "``sys.argv[0]`` から生成)" #: ../../library/argparse.rst:83 msgid "" "usage_ - The string describing the program usage (default: generated from " "arguments added to parser)" msgstr "" "usage_ - プログラムの利用方法を記述する文字列 (デフォルト: パーサーに追加され" "た引数から生成されます)" #: ../../library/argparse.rst:86 msgid "" "description_ - Text to display before the argument help (by default, no text)" msgstr "" "description_ - 引数のヘルプの前に表示されるテキスト (デフォルトはテキストなし" "です)" #: ../../library/argparse.rst:89 msgid "epilog_ - Text to display after the argument help (by default, no text)" msgstr "" "epilog_ - 引数のヘルプの後に表示されるテキスト (デフォルトはテキストなしです)" #: ../../library/argparse.rst:91 msgid "" "parents_ - A list of :class:`ArgumentParser` objects whose arguments should " "also be included" msgstr "" "parents_ - :class:`ArgumentParser` オブジェクトのリストで、このオブジェクトの" "引数が追加されます" #: ../../library/argparse.rst:94 msgid "formatter_class_ - A class for customizing the help output" msgstr "formatter_class_ - ヘルプ出力をカスタマイズするためのクラス" #: ../../library/argparse.rst:96 msgid "" "prefix_chars_ - The set of characters that prefix optional arguments " "(default: '-')" msgstr "" "prefix_chars_ - オプションの引数の prefix になる文字集合 (デフォルト: '-')" #: ../../library/argparse.rst:99 msgid "" "fromfile_prefix_chars_ - The set of characters that prefix files from which " "additional arguments should be read (default: ``None``)" msgstr "" "fromfile_prefix_chars_ - 追加の引数を読み込むファイルの prefix になる文字集" "合 (デフォルト: ``None``)" #: ../../library/argparse.rst:102 msgid "" "argument_default_ - The global default value for arguments (default: " "``None``)" msgstr "" "argument_default_ - 引数のグローバルなデフォルト値 (デフォルト: ``None``)" #: ../../library/argparse.rst:105 msgid "" "conflict_handler_ - The strategy for resolving conflicting optionals " "(usually unnecessary)" msgstr "conflict_handler_ - 衝突するオプションを解決する方法 (通常は不要)" #: ../../library/argparse.rst:108 msgid "" "add_help_ - Add a ``-h/--help`` option to the parser (default: ``True``)" msgstr "" "add_help_ - ``-h/--help`` オプションをパーサーに追加する (デフォルト: " "``True``)" msgid "" "allow_abbrev_ - Allows long options to be abbreviated if the abbreviation is " "unambiguous (default: ``True``)" msgstr "" "allow_abbrev_ - 意味が一意に決まる場合に、長いオプションの省略を許可する (デ" "フォルト: ``True``)" msgid "" "exit_on_error_ - Determines whether or not :class:`!ArgumentParser` exits " "with error info when an error occurs. (default: ``True``)" msgstr "" "exit_on_error_ - エラーが起きたときに、:class:`!ArgumentParser` がエラー情報" "を表示して終了するかどうか (デフォルト: ``True``)" msgid "" "suggest_on_error_ - Enables suggestions for mistyped argument choices and " "subparser names (default: ``True``)" msgstr "" "suggest_on_error_ - 引数の選択肢やサブパーサー名の入力ミスに対して候補を提示" "する (デフォルト: ``True``)" msgid "color_ - Allow color output (default: ``True``)" msgstr "color_ - 色付きの出力を許可する (デフォルト: ``True``)" #: ../../library/argparse.rst:121 msgid "*allow_abbrev* parameter was added." msgstr "*allow_abbrev* 引数が追加されました。" #: ../../library/argparse.rst:124 msgid "" "In previous versions, *allow_abbrev* also disabled grouping of short flags " "such as ``-vv`` to mean ``-v -v``." msgstr "" "以前のバージョンでは、 *allow_abbrev* は、``-vv`` が ``-v -v`` と等価になるよ" "うな、短いフラグのグループ化を無効にしていました。" #: ../../library/argparse.rst:128 msgid "*exit_on_error* parameter was added." msgstr "*exit_on_error* 引数が追加されました。" msgid "*suggest_on_error* and *color* parameters were added." msgstr "``suggest_on_error`` と ``color`` パラメーターが追加されました。" msgid "*suggest_on_error* default changed to ``True``." msgstr "``suggest_on_error`` のデフォルト値が ``True`` に変わりました。" #: ../../library/argparse.rst:137 ../../library/argparse.rst:699 msgid "The following sections describe how each of these are used." msgstr "以下の節では各オプションの利用方法を説明します。" #: ../../library/argparse.rst:143 msgid "prog" msgstr "``prog``" msgid "" "By default, :class:`ArgumentParser` calculates the name of the program to " "display in help messages depending on the way the Python interpreter was run:" msgstr "" "デフォルトでは、:class:`ArgumentParser` は Python インタープリタの実行方法に" "応じて、ヘルプに表示するプログラム名を求めます。" msgid "" "The :func:`base name <os.path.basename>` of ``sys.argv[0]`` if a file was " "passed as argument." msgstr "" "ファイルを引数に渡した場合は、``sys.argv[0]`` の :func:`ベース名 " "<os.path.basename>`。" msgid "" "The Python interpreter name followed by ``sys.argv[0]`` if a directory or a " "zipfile was passed as argument." msgstr "" "ディレクトリか ZIP ファイルを引数に渡した場合は、Python インタープリタの名前" "に ``sys.argv[0]`` を続けたもの。" msgid "" "The Python interpreter name followed by ``-m`` followed by the module or " "package name if the :option:`-m` option was used." msgstr "" ":option:`-m` オプションを使った場合は、Python インタープリタの名前に ``-m``、" "モジュール名またはパッケージ名を続けたもの。" msgid "" "This default is almost always desirable because it will make the help " "messages match the string that was used to invoke the program on the command " "line. However, to change this default behavior, another value can be " "supplied using the ``prog=`` argument to :class:`ArgumentParser`::" msgstr "" "このデフォルトの動作では、コマンドラインでプログラムを実行した文字列とヘルプ" "の表記が一致するので、ほとんどの場合に適しています。\n" "変更したい場合は、:class:`ArgumentParser` の ``prog=`` 引数に別の値を指定でき" "ます。 ::" msgid "" ">>> parser = argparse.ArgumentParser(prog='myprogram')\n" ">>> parser.print_help()\n" "usage: myprogram [-h]\n" "\n" "options:\n" " -h, --help show this help message and exit" msgstr "" ">>> parser = argparse.ArgumentParser(prog='myprogram')\n" ">>> parser.print_help()\n" "usage: myprogram [-h]\n" "\n" "options:\n" " -h, --help show this help message and exit" msgid "" "Note that the program name, whether determined from ``sys.argv[0]``, from " "the ``__main__`` module attributes or from the ``prog=`` argument, is " "available to help messages using the ``%(prog)s`` format specifier." msgstr "" "プログラム名は、``sys.argv[0]``、``__main__`` モジュールの属性、``prog=`` 引" "数のどれから決まった場合でも、ヘルプ内で書式指定子 ``%(prog)s`` を使って参照" "できます。" msgid "" ">>> parser = argparse.ArgumentParser(prog='myprogram')\n" ">>> parser.add_argument('--foo', help='foo of the %(prog)s program')\n" ">>> parser.print_help()\n" "usage: myprogram [-h] [--foo FOO]\n" "\n" "options:\n" " -h, --help show this help message and exit\n" " --foo FOO foo of the myprogram program" msgstr "" ">>> parser = argparse.ArgumentParser(prog='myprogram')\n" ">>> parser.add_argument('--foo', help='foo of the %(prog)s program')\n" ">>> parser.print_help()\n" "usage: myprogram [-h] [--foo FOO]\n" "\n" "options:\n" " -h, --help show this help message and exit\n" " --foo FOO foo of the myprogram program" msgid "" "The default ``prog`` value now reflects how ``__main__`` was actually " "executed, rather than always being ``os.path.basename(sys.argv[0])``." msgstr "" "デフォルトの ``prog`` 値は、常に ``os.path.basename(sys.argv[0])`` になるので" "はなく、``__main__`` の実際の実行方法を反映するようになりました。" #: ../../library/argparse.rst:189 msgid "usage" msgstr "usage" msgid "" "By default, :class:`ArgumentParser` calculates the usage message from the " "arguments it contains. The default message can be overridden with the " "``usage=`` keyword argument::" msgstr "" "デフォルトでは、:class:`ArgumentParser` は登録された引数から使用法のメッセー" "ジを生成します。\n" "``usage=`` キーワード引数を指定すると、このメッセージを置き換えられます。 ::" msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', usage='%(prog)s " "[options]')\n" ">>> parser.add_argument('--foo', nargs='?', help='foo help')\n" ">>> parser.add_argument('bar', nargs='+', help='bar help')\n" ">>> parser.print_help()\n" "usage: PROG [options]\n" "\n" "positional arguments:\n" " bar bar help\n" "\n" "options:\n" " -h, --help show this help message and exit\n" " --foo [FOO] foo help" msgstr "" ">>> parser = argparse.ArgumentParser(prog='PROG', usage='%(prog)s " "[options]')\n" ">>> parser.add_argument('--foo', nargs='?', help='foo help')\n" ">>> parser.add_argument('bar', nargs='+', help='bar help')\n" ">>> parser.print_help()\n" "usage: PROG [options]\n" "\n" "positional arguments:\n" " bar bar help\n" "\n" "options:\n" " -h, --help show this help message and exit\n" " --foo [FOO] foo help" #: ../../library/argparse.rst:208 msgid "" "The ``%(prog)s`` format specifier is available to fill in the program name " "in your usage messages." msgstr "" "``%(prog)s`` フォーマット指定子を、使用法メッセージ内でプログラム名として利用" "できます。" msgid "" "When a custom usage message is specified for the main parser, you may also " "want to consider passing the ``prog`` argument " "to :meth:`~ArgumentParser.add_subparsers` or the ``prog`` and the ``usage`` " "arguments to :meth:`~_SubParsersAction.add_parser`, to ensure consistent " "command prefixes and usage information across subparsers." msgstr "" "メインのパーサーに独自の使用法メッセージを指定する場合は、サブパーサー間でコ" "マンドの先頭部分や使用法の情報を揃えるた" "め、:meth:`~ArgumentParser.add_subparsers` に ``prog`` 引数を渡す" "か、:meth:`~_SubParsersAction.add_parser` に ``prog`` と ``usage`` 引数を渡す" "ことも検討してください。" #: ../../library/argparse.rst:221 msgid "description" msgstr "description" 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 "" ":class:`ArgumentParser` コンストラクターを呼ぶ際は、多くの場合 " "``description=`` キーワード引数を使います。\n" "この引数には、プログラムが何をどのように行うかの簡潔な説明を指定します。\n" "ヘルプでは、コマンドラインの使用法を示す文字列と各引数のヘルプの間に表示され" "ます。" #: ../../library/argparse.rst:229 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 "" "デフォルトでは、説明は与えられたスペースに合わせて折り返されます。この挙動を" "変更するには、formatter_class_ 引数を参照してください。" #: ../../library/argparse.rst:234 msgid "epilog" msgstr "epilog" #: ../../library/argparse.rst:236 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 "" "いくつかのプログラムは、プログラムについての追加の説明を引数の説明の後に表示" "します。このテキストは :class:`ArgumentParser` の ``epilog=`` 引数に指定でき" "ます::" msgid "" ">>> parser = argparse.ArgumentParser(\n" "... description='A foo that bars',\n" "... epilog=\"And that's how you'd foo a bar\")\n" ">>> parser.print_help()\n" "usage: argparse.py [-h]\n" "\n" "A foo that bars\n" "\n" "options:\n" " -h, --help show this help message and exit\n" "\n" "And that's how you'd foo a bar" msgstr "" ">>> parser = argparse.ArgumentParser(\n" "... description='A foo that bars',\n" "... epilog=\"And that's how you'd foo a bar\")\n" ">>> parser.print_help()\n" "usage: argparse.py [-h]\n" "\n" "A foo that bars\n" "\n" "options:\n" " -h, --help show this help message and exit\n" "\n" "And that's how you'd foo a bar" #: ../../library/argparse.rst:253 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 "" "description_ 引数と同じく、``epilog=`` テキストもデフォルトで折り返さ" "れ、:class:`ArgumentParser` の formatter_class_ 引数で動作を調整できます。" #: ../../library/argparse.rst:259 msgid "parents" msgstr "parents" #: ../../library/argparse.rst:261 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 "" "ときどき、いくつかのパーサーが共通の引数セットを共有することがあります。それ" "らの引数を繰り返し定義する代わりに、すべての共通引数を持ったパーサー" "を :class:`ArgumentParser` の ``parents=`` 引数に渡すことができます。 " "``parents=`` 引数は :class:`ArgumentParser` オブジェクトのリストを受け取り、" "すべての位置アクションとオプションのアクションをそれらから集め、そのアクショ" "ンを構築中の :class:`ArgumentParser` オブジェクトに追加します::" msgid "" ">>> parent_parser = argparse.ArgumentParser(add_help=False)\n" ">>> parent_parser.add_argument('--parent', type=int)\n" "\n" ">>> foo_parser = argparse.ArgumentParser(parents=[parent_parser])\n" ">>> foo_parser.add_argument('foo')\n" ">>> foo_parser.parse_args(['--parent', '2', 'XXX'])\n" "Namespace(foo='XXX', parent=2)\n" "\n" ">>> bar_parser = argparse.ArgumentParser(parents=[parent_parser])\n" ">>> bar_parser.add_argument('--bar')\n" ">>> bar_parser.parse_args(['--bar', 'YYY'])\n" "Namespace(bar='YYY', parent=None)" msgstr "" ">>> parent_parser = argparse.ArgumentParser(add_help=False)\n" ">>> parent_parser.add_argument('--parent', type=int)\n" "\n" ">>> foo_parser = argparse.ArgumentParser(parents=[parent_parser])\n" ">>> foo_parser.add_argument('foo')\n" ">>> foo_parser.parse_args(['--parent', '2', 'XXX'])\n" "Namespace(foo='XXX', parent=2)\n" "\n" ">>> bar_parser = argparse.ArgumentParser(parents=[parent_parser])\n" ">>> bar_parser.add_argument('--bar')\n" ">>> bar_parser.parse_args(['--bar', 'YYY'])\n" "Namespace(bar='YYY', parent=None)" 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 "" "多くの親パーサーでは ``add_help=False`` を指定します。\n" "そうしないと、:class:`ArgumentParser` は親と子に一つずつ、計二つの ``-h/--" "help`` オプションを検出してエラーを発生させます。" #: ../../library/argparse.rst:286 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 "" "``parents=`` に渡す前にパーサーを完全に初期化する必要があります。子パーサーを" "作成してから親パーサーを変更した場合、その変更は子パーサーに反映されません。" #: ../../library/argparse.rst:294 msgid "formatter_class" msgstr "formatter_class" #: ../../library/argparse.rst:296 msgid "" ":class:`ArgumentParser` objects allow the help formatting to be customized " "by specifying an alternate formatting class. Currently, there are four such " "classes:" msgstr "" ":class:`ArgumentParser` オブジェクトは代わりのフォーマットクラスを指定するこ" "とでヘルプのフォーマットをカスタマイズできます。現在、4つのフォーマットクラス" "があります:" #: ../../library/argparse.rst:305 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` と :class:`RawTextHelpFormatter` はどの" "ようにテキストの説明を表示するかを指定できます。デフォルトで" "は :class:`ArgumentParser` オブジェクトはコマンドラインヘルプの中の " "description_ と epilog_ を折り返して表示します::" msgid "" ">>> parser = argparse.ArgumentParser(\n" "... prog='PROG',\n" "... description='''this description\n" "... was indented weird\n" "... but that is okay''',\n" "... epilog='''\n" "... likewise for this epilog whose whitespace will\n" "... be cleaned up and whose words will be wrapped\n" "... across a couple lines''')\n" ">>> parser.print_help()\n" "usage: PROG [-h]\n" "\n" "this description was indented weird but that is okay\n" "\n" "options:\n" " -h, --help show this help message and exit\n" "\n" "likewise for this epilog whose whitespace will be cleaned up and whose " "words\n" "will be wrapped across a couple lines" msgstr "" ">>> parser = argparse.ArgumentParser(\n" "... prog='PROG',\n" "... description='''this description\n" "... was indented weird\n" "... but that is okay''',\n" "... epilog='''\n" "... likewise for this epilog whose whitespace will\n" "... be cleaned up and whose words will be wrapped\n" "... across a couple lines''')\n" ">>> parser.print_help()\n" "usage: PROG [-h]\n" "\n" "this description was indented weird but that is okay\n" "\n" "options:\n" " -h, --help show this help message and exit\n" "\n" "likewise for this epilog whose whitespace will be cleaned up and whose " "words\n" "will be wrapped across a couple lines" #: ../../library/argparse.rst:330 msgid "" "Passing :class:`RawDescriptionHelpFormatter` as ``formatter_class=`` " "indicates that description_ and epilog_ are already correctly formatted and " "should not be line-wrapped::" msgstr "" "``formatter_class=`` に :class:`RawDescriptionHelpFormatter` を渡した場合、 " "description_ と epilog_ は整形済みとされ改行されません::" msgid "" ">>> parser = argparse.ArgumentParser(\n" "... prog='PROG',\n" "... formatter_class=argparse.RawDescriptionHelpFormatter,\n" "... description=textwrap.dedent('''\\\n" "... Please do not mess up this text!\n" "... --------------------------------\n" "... I have indented it\n" "... exactly the way\n" "... I want it\n" "... '''))\n" ">>> parser.print_help()\n" "usage: PROG [-h]\n" "\n" "Please do not mess up this text!\n" "--------------------------------\n" " I have indented it\n" " exactly the way\n" " I want it\n" "\n" "options:\n" " -h, --help show this help message and exit" msgstr "" ">>> parser = argparse.ArgumentParser(\n" "... prog='PROG',\n" "... formatter_class=argparse.RawDescriptionHelpFormatter,\n" "... description=textwrap.dedent('''\\\n" "... Please do not mess up this text!\n" "... --------------------------------\n" "... I have indented it\n" "... exactly the way\n" "... I want it\n" "... '''))\n" ">>> parser.print_help()\n" "usage: PROG [-h]\n" "\n" "Please do not mess up this text!\n" "--------------------------------\n" " I have indented it\n" " exactly the way\n" " I want it\n" "\n" "options:\n" " -h, --help show this help message and exit" msgid "" ":class:`RawTextHelpFormatter` maintains whitespace for all sorts of help " "text, including argument descriptions. However, multiple newlines are " "replaced with one. If you wish to preserve multiple blank lines, add spaces " "between the newlines." msgstr "" ":class:`RawTextHelpFormatter` は、引数の説明を含むすべてのヘルプテキストの空" "白を保持します。\n" "ただし、連続する改行は一つにまとめられます。\n" "複数の空行を残したい場合は、改行の間にスペースを入れてください。" #: ../../library/argparse.rst:361 msgid "" ":class:`ArgumentDefaultsHelpFormatter` automatically adds information about " "default values to each of the argument help messages::" msgstr "" ":class:`ArgumentDefaultsHelpFormatter` は各引数のデフォルト値を自動的にヘルプ" "に追加します::" msgid "" ">>> parser = argparse.ArgumentParser(\n" "... prog='PROG',\n" "... formatter_class=argparse.ArgumentDefaultsHelpFormatter)\n" ">>> parser.add_argument('--foo', type=int, default=42, help='FOO!')\n" ">>> parser.add_argument('bar', nargs='*', default=[1, 2, 3], help='BAR!')\n" ">>> parser.print_help()\n" "usage: PROG [-h] [--foo FOO] [bar ...]\n" "\n" "positional arguments:\n" " bar BAR! (default: [1, 2, 3])\n" "\n" "options:\n" " -h, --help show this help message and exit\n" " --foo FOO FOO! (default: 42)" msgstr "" ">>> parser = argparse.ArgumentParser(\n" "... prog='PROG',\n" "... formatter_class=argparse.ArgumentDefaultsHelpFormatter)\n" ">>> parser.add_argument('--foo', type=int, default=42, help='FOO!')\n" ">>> parser.add_argument('bar', nargs='*', default=[1, 2, 3], help='BAR!')\n" ">>> parser.print_help()\n" "usage: PROG [-h] [--foo FOO] [bar ...]\n" "\n" "positional arguments:\n" " bar BAR! (default: [1, 2, 3])\n" "\n" "options:\n" " -h, --help show this help message and exit\n" " --foo FOO FOO! (default: 42)" #: ../../library/argparse.rst:379 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` は、各引数の値の表示名に type_ 引数の値を使" "用します (通常は dest_ の値が使用されます)::" msgid "" ">>> parser = argparse.ArgumentParser(\n" "... prog='PROG',\n" "... formatter_class=argparse.MetavarTypeHelpFormatter)\n" ">>> parser.add_argument('--foo', type=int)\n" ">>> parser.add_argument('bar', type=float)\n" ">>> parser.print_help()\n" "usage: PROG [-h] [--foo int] float\n" "\n" "positional arguments:\n" " float\n" "\n" "options:\n" " -h, --help show this help message and exit\n" " --foo int" msgstr "" ">>> parser = argparse.ArgumentParser(\n" "... prog='PROG',\n" "... formatter_class=argparse.MetavarTypeHelpFormatter)\n" ">>> parser.add_argument('--foo', type=int)\n" ">>> parser.add_argument('bar', type=float)\n" ">>> parser.print_help()\n" "usage: PROG [-h] [--foo int] float\n" "\n" "positional arguments:\n" " float\n" "\n" "options:\n" " -h, --help show this help message and exit\n" " --foo int" #: ../../library/argparse.rst:400 msgid "prefix_chars" msgstr "prefix_chars" 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 :class:`ArgumentParser` constructor::" msgstr "" "ほとんどのコマンドラインオプションでは、``-f/--foo`` のように接頭辞として ``-" "`` を使います。\n" "``+f`` や ``/foo`` のように、別の文字や追加の文字を接頭辞としてサポートする必" "要があるパーサーでは、:class:`ArgumentParser` コンストラクターの " "``prefix_chars=`` 引数でそれらの文字を指定できます。 ::" msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', prefix_chars='-+')\n" ">>> parser.add_argument('+f')\n" ">>> parser.add_argument('++bar')\n" ">>> parser.parse_args('+f X ++bar Y'.split())\n" "Namespace(bar='Y', f='X')" msgstr "" ">>> parser = argparse.ArgumentParser(prog='PROG', prefix_chars='-+')\n" ">>> parser.add_argument('+f')\n" ">>> parser.add_argument('++bar')\n" ">>> parser.parse_args('+f X ++bar Y'.split())\n" "Namespace(bar='Y', f='X')" #: ../../library/argparse.rst:414 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 "" "``prefix_chars=`` 引数のデフォルトは ``'-'`` です。``-`` を含まない文字セット" "を指定すると、``-f/--foo`` オプションが使用できなくなります。" #: ../../library/argparse.rst:420 msgid "fromfile_prefix_chars" msgstr "fromfile_prefix_chars" #: ../../library/argparse.rst:422 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 "" "ときどき、非常に長い引数リストを扱う場合に、その引数リストを毎回コマンドライ" "ンにタイプする代わりにファイルに置いておきたい場合がありま" "す。:class:`ArgumentParser` のコンストラクターに ``fromfile_prefix_chars=`` " "引数が渡された場合、指定された文字のいずれかで始まる引数はファイルとして扱わ" "れ、そのファイルに含まれる引数リストに置換されます。例えば::" msgid "" ">>> with open('args.txt', 'w', encoding=sys.getfilesystemencoding()) as fp:\n" "... fp.write('-f\\nbar')\n" "...\n" ">>> parser = argparse.ArgumentParser(fromfile_prefix_chars='@')\n" ">>> parser.add_argument('-f')\n" ">>> parser.parse_args(['-f', 'foo', '@args.txt'])\n" "Namespace(f='bar')" msgstr "" ">>> with open('args.txt', 'w', encoding=sys.getfilesystemencoding()) as fp:\n" "... fp.write('-f\\nbar')\n" "...\n" ">>> parser = argparse.ArgumentParser(fromfile_prefix_chars='@')\n" ">>> parser.add_argument('-f')\n" ">>> parser.parse_args(['-f', 'foo', '@args.txt'])\n" "Namespace(f='bar')" msgid "" "Arguments read from a file must be one per line by default (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 "" "デフォルトでは、ファイルから読み込む引数は 1 行に一つずつ記述します " "(:meth:`~ArgumentParser.convert_arg_line_to_args` も参照してください)。\n" "読み込んだ引数は、コマンドラインでそのファイルを指定した引数の位置にあるもの" "として扱われます。\n" "上の例では、``['-f', 'foo', '@args.txt']`` は ``['-f', 'foo', '-f', 'bar']`` " "と同じものとして扱われます。" msgid "" "Each line is treated as a single argument, so an empty line is read as an " "empty string (``''``)." msgstr "" "各行が一つの引数として扱われるので、空行は空文字列 (``''``) として読み込まれ" "ます。" msgid "" ":class:`ArgumentParser` uses :term:`filesystem encoding and error handler` " "to read the file containing arguments." msgstr "" ":class:`ArgumentParser` は、引数を記述したファイルを :term:`filesystem " "encoding and error handler` を使って読み込みます。" #: ../../library/argparse.rst:451 msgid "" "The ``fromfile_prefix_chars=`` argument defaults to ``None``, meaning that " "arguments will never be treated as file references." msgstr "" "``fromfile_prefix_chars=`` 引数のデフォルト値は ``None`` で、引数がファイル参" "照として扱われることがないことを意味しています。" msgid "" ":class:`ArgumentParser` changed encoding and errors to read arguments files " "from default (e.g. :func:`locale.getpreferredencoding(False) " "<locale.getpreferredencoding>` and ``\"strict\"``) to the :term:`filesystem " "encoding and error handler`. Arguments file should be encoded in UTF-8 " "instead of ANSI Codepage on Windows." msgstr "" ":class:`ArgumentParser` が引数ファイルの読み込みに使うエンコーディングとエ" "ラーハンドラーを、デフォルト値 (:func:`locale.getpreferredencoding(False) " "<locale.getpreferredencoding>` と ``\"strict\"`` など) か" "ら :term:`filesystem encoding and error handler` に変更しました。\n" "Windows では、引数ファイルを ANSI コードページではなく UTF-8 でエンコードして" "ください。" #: ../../library/argparse.rst:462 msgid "argument_default" msgstr "argument_default" #: ../../library/argparse.rst:464 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 "" "一般的には、引数のデフォルト値は :meth:`~ArgumentParser.add_argument` メソッ" "ドにデフォルト値を渡すか、:meth:`~ArgumentParser.set_defaults` メソッドに名前" "と値のペアを渡すことで指定します。しかしまれに、1つのパーサー全体に適用される" "デフォルト引数が便利なことがあります。これを行うに" "は、 :class:`ArgumentParser` に ``argument_default=`` キーワード引数を渡しま" "す。例えば、全体で :meth:`~ArgumentParser.parse_args` メソッド呼び出しの属性" "の生成を抑制するには、``argument_default=SUPPRESS`` を指定します::" msgid "" ">>> parser = argparse.ArgumentParser(argument_default=argparse.SUPPRESS)\n" ">>> parser.add_argument('--foo')\n" ">>> parser.add_argument('bar', nargs='?')\n" ">>> parser.parse_args(['--foo', '1', 'BAR'])\n" "Namespace(bar='BAR', foo='1')\n" ">>> parser.parse_args([])\n" "Namespace()" msgstr "" ">>> parser = argparse.ArgumentParser(argument_default=argparse.SUPPRESS)\n" ">>> parser.add_argument('--foo')\n" ">>> parser.add_argument('bar', nargs='?')\n" ">>> parser.parse_args(['--foo', '1', 'BAR'])\n" "Namespace(bar='BAR', foo='1')\n" ">>> parser.parse_args([])\n" "Namespace()" #: ../../library/argparse.rst:484 msgid "allow_abbrev" msgstr "allow_abbrev" #: ../../library/argparse.rst:486 msgid "" "Normally, when you pass an argument list to " "the :meth:`~ArgumentParser.parse_args` method of an :class:`ArgumentParser`, " "it :ref:`recognizes abbreviations <prefix-matching>` of long options." msgstr "" "通常、:class:`ArgumentParser` の :meth:`~ArgumentParser.parse_args` に引数の" "リストを渡すとき、長いオプションは :ref:`短縮しても認識されます <prefix-" "matching>`。" #: ../../library/argparse.rst:490 msgid "This feature can be disabled by setting ``allow_abbrev`` to ``False``::" msgstr "" "この機能は、``allow_abbrev`` に ``False`` を指定することで無効にできます::" msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', allow_abbrev=False)\n" ">>> parser.add_argument('--foobar', action='store_true')\n" ">>> parser.add_argument('--foonley', action='store_false')\n" ">>> parser.parse_args(['--foon'])\n" "usage: PROG [-h] [--foobar] [--foonley]\n" "PROG: error: unrecognized arguments: --foon" msgstr "" ">>> parser = argparse.ArgumentParser(prog='PROG', allow_abbrev=False)\n" ">>> parser.add_argument('--foobar', action='store_true')\n" ">>> parser.add_argument('--foonley', action='store_false')\n" |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |