當前位置: 首頁>>代碼示例>>Python>>正文


Python argparse.MetavarTypeHelpFormatter方法代碼示例

本文整理匯總了Python中argparse.MetavarTypeHelpFormatter方法的典型用法代碼示例。如果您正苦於以下問題:Python argparse.MetavarTypeHelpFormatter方法的具體用法?Python argparse.MetavarTypeHelpFormatter怎麽用?Python argparse.MetavarTypeHelpFormatter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在argparse的用法示例。


在下文中一共展示了argparse.MetavarTypeHelpFormatter方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: view_area_command

# 需要導入模塊: import argparse [as 別名]
# 或者: from argparse import MetavarTypeHelpFormatter [as 別名]
def view_area_command(sub_parsers):
    parser: ArgumentParser = sub_parsers.add_parser(
        "view-area",
        help="View information about an area.",
        formatter_class=argparse.MetavarTypeHelpFormatter
    )
    add_data_file_argument(parser)
    parser.add_argument(
        "--simplify",
        action="store_true",
        help="Simplify the RequirementSets"
    )
    parser.add_argument(
        "world",
        type=str,
        help="The name of the world that contains the area."
    )
    parser.add_argument(
        "area",
        type=str,
        help="The name of the area."
    )

    parser.set_defaults(func=view_area_command_logic) 
開發者ID:randovania,項目名稱:randovania,代碼行數:26,代碼來源:prime_database.py

示例2: create_convert_database_command

# 需要導入模塊: import argparse [as 別名]
# 或者: from argparse import MetavarTypeHelpFormatter [as 別名]
def create_convert_database_command(sub_parsers):
    parser: ArgumentParser = sub_parsers.add_parser(
        "convert-database",
        help="Converts a database file between JSON and binary encoded formats. Input defaults to embedded database.",
        formatter_class=argparse.MetavarTypeHelpFormatter
    )
    add_data_file_argument(parser)
    parser.add_argument(
        "--decode-to-game-description",
        action="store_true",
        default=False,
        help="Decodes the input data to a GameDescription, then encodes it back."
    )

    group = parser.add_mutually_exclusive_group(required=True)
    group.add_argument(
        "--output-binary",
        type=Path,
        help="Export as a binary file.",
    )
    group.add_argument(
        "--output-json",
        type=Path,
        help="Export as a JSON file.",
    )

    parser.set_defaults(func=convert_database_command_logic) 
開發者ID:randovania,項目名稱:randovania,代碼行數:29,代碼來源:prime_database.py

示例3: export_areas_command

# 需要導入模塊: import argparse [as 別名]
# 或者: from argparse import MetavarTypeHelpFormatter [as 別名]
def export_areas_command(sub_parsers):
    parser: ArgumentParser = sub_parsers.add_parser(
        "export-areas",
        help="Export a text file with all areas and their requirements",
        formatter_class=argparse.MetavarTypeHelpFormatter
    )
    add_data_file_argument(parser)
    parser.add_argument("output_file", type=Path)
    parser.set_defaults(func=export_areas_command_logic) 
開發者ID:randovania,項目名稱:randovania,代碼行數:11,代碼來源:prime_database.py

示例4: list_paths_with_dangerous_command

# 需要導入模塊: import argparse [as 別名]
# 或者: from argparse import MetavarTypeHelpFormatter [as 別名]
def list_paths_with_dangerous_command(sub_parsers):
    parser: ArgumentParser = sub_parsers.add_parser(
        "list-dangerous-usage",
        help="List all connections that needs a resource to be missing.",
        formatter_class=argparse.MetavarTypeHelpFormatter
    )
    add_data_file_argument(parser)
    parser.add_argument("--print-only-area", help="Only print the area names, not each specific path",
                        action="store_true")
    parser.set_defaults(func=list_paths_with_dangerous_logic) 
開發者ID:randovania,項目名稱:randovania,代碼行數:12,代碼來源:prime_database.py

示例5: list_paths_with_difficulty_command

# 需要導入模塊: import argparse [as 別名]
# 或者: from argparse import MetavarTypeHelpFormatter [as 別名]
def list_paths_with_difficulty_command(sub_parsers):
    parser: ArgumentParser = sub_parsers.add_parser(
        "list-difficulty-usage",
        help="List all connections that needs the difficulty.",
        formatter_class=argparse.MetavarTypeHelpFormatter
    )
    add_data_file_argument(parser)
    parser.add_argument("--print-only-area", help="Only print the area names, not each specific path",
                        action="store_true")
    parser.add_argument("difficulty", type=int)
    parser.set_defaults(func=list_paths_with_difficulty_logic) 
開發者ID:randovania,項目名稱:randovania,代碼行數:13,代碼來源:prime_database.py

示例6: main

# 需要導入模塊: import argparse [as 別名]
# 或者: from argparse import MetavarTypeHelpFormatter [as 別名]
def main():
    import argparse
    class MyFormatter(argparse.ArgumentDefaultsHelpFormatter, argparse.MetavarTypeHelpFormatter):
        pass
    parser = argparse.ArgumentParser(
        formatter_class=MyFormatter,
        description='Command line tool for training potential model with PiNN.')
    parser.add_argument('--model-dir', type=str, required=True,
                        help='model directory')
    parser.add_argument('--params-file', type=str, required=True,
                        help='path to parameters (.yml file)')
    parser.add_argument('--train-data',  type=str, required=True,
                        help='path to training data (.yml file)')
    parser.add_argument('--eval-data',   type=str, required=True,
                        help='path to evaluation data (.yml file)')
    parser.add_argument('--train-steps', type=int, required=True,
                        help='number of training steps')
    parser.add_argument('--eval-steps',  type=int, 
                        help='number of evaluation steps', default=100)
    parser.add_argument('--batch-size',  type=int,
                        help='Batch size to batch, default to None - data already batched',
                        default=None)
    parser.add_argument('--preprocess',  type=bool,
                        help='Preprocess the data', default=False)
    parser.add_argument('--scratch-dir',  type=str,
                        help='If set in preprocess mode, save the processed dataset to \
                              scratch folder', default=None)
    parser.add_argument('--cache-data',  type=bool,
                        help='cache the training data to memory', default=True)
    parser.add_argument('--shuffle-buffer',  type=int,
                        help='size of shuffle buffer', default=100)    
    parser.add_argument('--regen-dress', type=bool,
                        help='regenerate atomic dress using the training set', default=True)
    
    args = parser.parse_args()
    trainner(args.model_dir, args.params_file,
             args.train_data, args.eval_data,
             args.train_steps, args.eval_steps,
             args.batch_size, args.preprocess,
             args.scratch_dir, args.cache_data, 
             args.shuffle_buffer, args.regen_dress) 
開發者ID:Teoroo-CMC,項目名稱:PiNN,代碼行數:43,代碼來源:trainer.py

示例7: get_args

# 需要導入模塊: import argparse [as 別名]
# 或者: from argparse import MetavarTypeHelpFormatter [as 別名]
def get_args():
    """Get command line arguments

    """
    epoch_time = int(time.time())
    report_filename = "report_{}_{}.csv".format(time.strftime("%Y-%m-%d_%H%M"), epoch_time)
    parser = argparse.ArgumentParser(
        description='Compare DNS server responses.',formatter_class=argparse.MetavarTypeHelpFormatter)
    parser.add_argument('-o', type=str, default=report_filename, help='Report file name')
    parser.add_argument('-c', type=str, help='hpHosts feed (Default: PSH)', choices=['PSH', 'EMD', 'EXP'], default='PSH')
    parser.add_argument('-n', type=int, help='Number of hishing sites to test (Default: 500)', default=500)
    parser.add_argument('-s', type=int, help='Shell type: set to 1 if spinner errors occur (default: 0)', default=0)
    args = parser.parse_args()
    return args 
開發者ID:cryptoaustralia,項目名稱:dingoes,代碼行數:16,代碼來源:dingoes.py


注:本文中的argparse.MetavarTypeHelpFormatter方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。